View Source Yex.Sync (y_ex v0.6.2)

Sync protocol.

Summary

Types

@type message() ::
  {:sync, sync_message()}
  | :query_awareness
  | {:awareness, message()}
  | {:auth, term()}
@type sync_message() ::
  {:sync_step1, encoded_state_vector :: binary()}
  | {:sync_step2, encoded_diff :: binary()}
  | {:sync_update, encoded_diff :: binary()}

Functions

Create a sync step 1 message based on the state of the current shared document.

Link to this function

get_sync_step2(doc, encoded_state_vector)

View Source
@spec message_decode(binary()) :: {:ok, message()} | {:error, term()}
Link to this function

message_decode!(message)

View Source
@spec message_decode!(binary()) :: message()

Decode a message.

Examples

iex> Yex.Sync.message_decode(<<0, 0, 1,0>>)
{:ok, {:sync, {:sync_step1, <<0>>}}}
Link to this function

message_decode_v1(message)

View Source
@spec message_decode_v1(binary()) :: {:ok, message()} | {:error, term()}
Link to this function

message_decode_v2(message)

View Source
@spec message_decode_v2(binary()) :: {:ok, message()} | {:error, term()}
@spec message_encode(message()) :: {:ok, binary()} | {:error, term()}

Encode a message.

Examples

iex> Yex.Sync.message_encode({:sync, {:sync_step1, <<0>>}})
{:ok, <<0, 0, 1,0>>}
Link to this function

message_encode!(message)

View Source
@spec message_encode!(message()) :: binary()
Link to this function

message_encode_v1(message)

View Source
@spec message_encode_v1(message()) :: {:ok, binary()} | {:error, term()}
Link to this function

message_encode_v2(message)

View Source
@spec message_encode_v2(message()) :: {:ok, binary()} | {:error, term()}
Link to this function

read_sync_message(message, doc, transactionOrigin)

View Source
@spec read_sync_message(sync_message(), Yex.Doc.t(), term()) ::
  {:ok, term()} | {:error, term()}
Link to this function

read_sync_step1(encoded_state_vector, doc)

View Source
Link to this function

read_sync_step2(update, doc, transactionOrigin)

View Source