Jido.Bus.Adapter behaviour (Jido v1.1.0-rc)
View SourceDefines the behaviour to be implemented by an signal store adapter to be used by Commanded.
Summary
Callbacks
Acknowledge receipt and successful processing of the given signal received from a subscription to an signal stream.
Return a child spec defining all processes required by the signal store.
Delete a previously recorded snapshot for a given source
Append one or more signals to a stream atomically.
Read a snapshot, if available, for a given source.
Record a snapshot of the data and metadata for a given source
Streams signals from the given stream, in the order in which they were originally written.
Create a transient subscription to a single signal stream.
Create a persistent subscription to an signal stream.
Unsubscribe an existing subscriber from signal notifications.
Delete an existing subscription.
Types
@type application() :: Commanded.Application.t()
@type bus() :: map()
@type config() :: Keyword.t()
@type error() :: term()
@type expected_version() :: :any_version | :no_stream | :stream_exists | non_neg_integer()
@type source_id() :: String.t()
@type start_from() :: :origin | :current | integer()
@type stream_id() :: String.t()
@type subscriber() :: pid()
@type subscription() :: any()
@type subscription_name() :: String.t()
Callbacks
Acknowledge receipt and successful processing of the given signal received from a subscription to an signal stream.
@callback child_spec(application(), config()) :: {:ok, [:supervisor.child_spec() | {module(), term()} | module()], bus()}
Return a child spec defining all processes required by the signal store.
Delete a previously recorded snapshot for a given source
@callback publish( bus(), stream_id(), expected_version(), signals :: [Jido.Bus.Signal.t()], opts :: Keyword.t() ) :: :ok | {:error, :wrong_expected_version} | {:error, error()}
Append one or more signals to a stream atomically.
@callback read_snapshot(bus(), source_id()) :: {:ok, Jido.Bus.Snapshot.t()} | {:error, :snapshot_not_found}
Read a snapshot, if available, for a given source.
Record a snapshot of the data and metadata for a given source
@callback replay( bus(), stream_id(), start_version :: non_neg_integer(), read_batch_size :: non_neg_integer() ) :: Enumerable.t() | {:error, :stream_not_found} | {:error, error()}
Streams signals from the given stream, in the order in which they were originally written.
Create a transient subscription to a single signal stream.
The signal store will publish any signals appended to the given stream to the
subscriber
process as an {:signals, signals}
message.
The subscriber does not need to acknowledge receipt of the signals.
@callback subscribe_persistent( bus(), stream_id() | :all, subscription_name(), subscriber(), start_from(), opts :: Keyword.t() ) :: {:ok, subscription()} | {:error, :subscription_already_exists} | {:error, error()}
Create a persistent subscription to an signal stream.
@callback unsubscribe(bus(), subscription()) :: :ok
Unsubscribe an existing subscriber from signal notifications.
This should not delete the subscription.
@callback unsubscribe( bus(), stream_id() | :all, subscription_name() ) :: :ok | {:error, :subscription_not_found} | {:error, error()}
Delete an existing subscription.