ExESDB.GatewayAPI (ex_esdb v0.0.16)
Though the GatewayAPI GenServer is started on each node in the cluster, it acts as a simple high-availability proxy and load balancer for the GatewayWorker processes in the cluster.
Summary
Functions
Acknowledge receipt of an event by a subscriber to persistent subscription.
Append events to a stream. ## Parameters
Returns a specification to start this module under a supervisor.
Gets a list of all gateway worker pids.
Get events from a stream, staring from a given version, in a given direction.
Get all streams from the store. ## Parameters
Get the subscriptions for a store.
Get the version of a stream.
Callback implementation for GenServer.init/1
.
Gets a random pid of a gateway worker in the cluster.
Remove a permanent or transient subscription.
Add a permanent or transient subscription.
Types
Functions
@spec ack_event( store :: atom(), subscription_name :: String.t(), subscriber_pid :: pid(), event :: map() ) :: :ok | {:error, term()}
Acknowledge receipt of an event by a subscriber to persistent subscription.
@spec append_events( store :: atom(), stream_id :: stream(), events :: list() ) :: {:ok, integer()} | {:error, term()}
Append events to a stream. ## Parameters
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec delete_snapshot( store :: atom(), source_uuid :: binary(), stream_uuid :: binary(), version :: non_neg_integer() ) :: :ok
@spec gateway_worker_pids() :: list()
Gets a list of all gateway worker pids.
@spec get_events( store :: atom(), stream_id :: stream(), start_version :: integer(), count :: integer(), direction :: :forward | :backward ) :: {:ok, list()} | {:error, term()}
Get events from a stream, staring from a given version, in a given direction.
Get all streams from the store. ## Parameters
- store: the id of the store
## Returns
- a list of all streams in the store
Get the subscriptions for a store.
Get the version of a stream.
Callback implementation for GenServer.init/1
.
@spec random_gateway_worker() :: pid()
Gets a random pid of a gateway worker in the cluster.
@spec record_snapshot( store :: atom(), source_uuid :: binary(), stream_uuid :: binary(), version :: non_neg_integer(), snapshot_record :: map() ) :: :ok
@spec remove_subscription( store :: any(), type :: subscription_type(), selector :: selector_type(), subscription_name :: subscription_name() ) :: :ok | {:error, error()}
Remove a permanent or transient subscription.
save_subscription(store, type, selector, subscription_name \\ "transient", start_from \\ 0, subscriber \\ nil)
@spec save_subscription( store :: atom(), type :: atom(), selector :: String.t() | map(), subscription_name :: String.t(), start_from :: non_neg_integer(), subscriber :: pid() | nil ) :: :ok
Add a permanent or transient subscription.