Rill v0.10.4 Rill.MessageStore behaviour View Source

Link to this section Summary

Callbacks

Returned enumerable must be a stream from the given position until the end of the stream. If fun is passed, the stream will instead be reduced, with an accumulator value initially being nil and successive values will be those returned by fun

Link to this section Types

Link to this type

read_option() View Source
read_option() :: {:position, non_neg_integer()} | {:batch_size, pos_integer()}

Link to this type

write_option() View Source
write_option() ::
  {:expected_version, Rill.MessageStore.ExpectedVersion.t()}
  | {:reply_stream_name, String.t() | nil}

Link to this section Functions

Link to this function

read(session, stream_name, opts \\ [], fun \\ nil) View Source

Link to this function

write(session, message_or_messages, stream_name, opts \\ []) View Source

Link to this function

write_initial(session, message, stream_name) View Source

Link to this section Callbacks

Link to this callback

read(session, stream_name, opts, fun) View Source
read(
  session :: Rill.Session.t(),
  stream_name :: Rill.MessageStore.StreamName.t(),
  opts :: [read_option()],
  fun ::
    nil
    | (%Rill.MessageStore.MessageData.Read{
         data: term(),
         global_position: term(),
         id: term(),
         metadata: term(),
         position: term(),
         stream_name: term(),
         time: term(),
         type: term()
       },
       term() ->
         term())
) :: Enumerable.t() | term()

Returned enumerable must be a stream from the given position until the end of the stream. If fun is passed, the stream will instead be reduced, with an accumulator value initially being nil and successive values will be those returned by fun

Link to this callback

write(session, message_or_messages, stream_name, opts) View Source
write(
  session :: Rill.Session.t(),
  message_or_messages :: struct() | [struct()],
  stream_name :: Rill.MessageStore.StreamName.t(),
  opts :: [write_option()]
) :: non_neg_integer()

Link to this callback

write_initial(session, message, stream_name) View Source
write_initial(
  session :: Rill.Session.t(),
  message :: struct(),
  stream_name :: Rill.MessageStore.StreamName.t()
) :: non_neg_integer()