View Source OT.Type behaviour (OT v0.2.0-rc1)

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

@callback apply(binary(), list()) :: {:ok, binary()} | {:error, binary()}

Apply an operation to a datum of the type operated on by the OT type.

Link to this callback

compose(operation_a, operation_b)

View Source
@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.

Link to this callback

transform(operation_a, operation_b)

View Source
@callback transform(operation_a :: list(), operation_b :: list()) ::
  {:ok, list(), list()} | {:error, binary()}

Transform an operation against another operation.

Link to this callback

transform_index(operation_a, index)

View Source
@callback transform_index(operation_a :: list(), index :: pos_integer()) :: pos_integer()

Transform an index based on an operation.