View Source OT.Type behaviour (OT v0.2.0-rc2)
A behaviour for implementing an operational transformation type.
An operational transformation (OT) type is a module that is able to apply operations on a piece of data in any order and guarantee convergence of the two resulting data states.
Link to this section Summary
Callbacks
Apply an operation to a datum of the type operated on by the OT type.
Compose two operations together into a single operation.
Invoked in order to initialize a "blank" datum of the type operated on by the OT type.
Transform an operation against another operation.
Transform an index based on an operation.
Link to this section Callbacks
Apply an operation to a datum of the type operated on by the OT type.
@callback compose(operation_a :: list(), operation_b :: list()) :: {:ok, list()} | {:error, binary()}
Compose two operations together into a single operation.
@callback init() :: any()
Invoked in order to initialize a "blank" datum of the type operated on by the OT type.
@callback transform(operation_a :: list(), operation_b :: list()) :: {:ok, list(), list()} | {:error, binary()}
Transform an operation against another operation.
@callback transform_index(operation_a :: list(), index :: pos_integer()) :: pos_integer()
Transform an index based on an operation.