unsplit_lib.md
January 22, 2012 ยท View on GitHub
#Module unsplit_lib#
Predefined merge functions.
Authors: : Ulf Wiger (ulf.wiger@erlang-solutions.com).
##Description##
This module implements a few merge functions that can be used.
##Function Index##
| bag/2 | Default bag merge; removes duplicate objects. |
| last_modified/2 | Keeps the last modified object, based on the modified attribute. |
| last_version/2 | Picks the object with the greatest value of a given attribute. |
| no_action/2 | Minimal merge action - does nothing. |
| vclock/2 |
##Function Details##
###bag/2##
bag(Objs::Phase, S0::State) -> merge_ret()
Default bag merge; removes duplicate objects
###last_modified/2##
last_modified(Other::Phase, S0::State) -> merge_ret()
Keeps the last modified object, based on the modified attribute
This function assumes that the table to be merged contains objects with
a modified attribute.
###last_version/2##
last_version(Objs::Phase, S::State) -> merge_ret()
Picks the object with the greatest value of a given attribute
This function assumes that an attribute name is passed as an extra argument.
e.g. by adding the following user property to the table:
{unsplit_method, {unsplit_lib, last_version, [Attr]}}
The function will choose the object that has the greatest value in the
position given by Attr.
###no_action/2##
no_action(X1::init, X2::State) -> stop
Minimal merge action - does nothing
###vclock/2##
vclock(Objs, S) -> any()