ExESDBGater.API (ex_esdb_gater v0.0.6)
The ExESDBGater.API GenServer acts as a simple high-availability proxy and load balancer for the GaterWorker 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.
Create a new store dynamically in the cluster.
Gets a list of all gateway worker pids.
Get events from a stream, staring from a given version, in a given direction.
Get the configuration of a specific store.
Get the status of a specific store.
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
.
List all managed stores in the cluster.
Gets a random pid of a gateway worker in the cluster.
Remove a store from the cluster.
Remove 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
.
Create a new store dynamically in the cluster.
## Parameters
- store_id: Unique identifier for the store (atom)
- config: Optional configuration overrides (keyword list)
## Returns
:ok
(fire-and-forget operation)
@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 the configuration of a specific store.
## Parameters
- store_id: The store identifier
## Returns
{:ok, config}
if store exists{:error, :not_found}
if store doesn't exist
Get the status of a specific store.
## Parameters
- store_id: The store identifier
## Returns
{:ok, status}
if store exists{:error, :not_found}
if store doesn't exist
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
.
List all managed stores in the cluster.
## Returns
{:ok, stores_map}
containing store information{:error, reason}
if failed
@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_store(store_id :: atom()) :: :ok
Remove a store from the cluster.
## Parameters
- store_id: The store identifier to remove
## Returns
:ok
(fire-and-forget operation)
@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
Description
Add a permanent or transient subscription.