brook v0.6.0 Brook.Storage behaviour
Defines the Brook.Storage
behaviour that must be implemented by
storage driver processes. Starts a process and defines a child specification
for including the driver in Brook's supervision tree.
Implements the CRUD functionality for persisting events to the application view state within the storage driver and subsequent retrieval.
Link to this section Summary
Callbacks
Define a child specification for including the storage driver in the Brook supervision tree.
Delete the record of a saved value from the view state within a given collection and identified by a given key.
Return a value from the persisted view state stored within a collection and identified by a key.
Return all values saved to the application view state within the storage system under a given collection. Events are returned as a map with the identifying keys as keys and the saved values as values.
Return a list of events that produced a value saved to the application view state within the storage system under a given collection and idetifying key.
Save a value from a processed event to the application view state stored on the underlying storage system. Events are saved to a collection of related events under a given identifying key.
Start the storage driver and link it to the current process.
Link to this section Callbacks
Define a child specification for including the storage driver in the Brook supervision tree.
delete(arg1, arg2, arg3)
delete(Brook.instance(), Brook.view_collection(), Brook.view_key()) :: :ok | {:error, Brook.reason()}
Delete the record of a saved value from the view state within a given collection and identified by a given key.
get(arg1, arg2, arg3)
get(Brook.instance(), Brook.view_collection(), Brook.view_key()) :: {:ok, Brook.view_value()} | {:error, Brook.reason()}
Return a value from the persisted view state stored within a collection and identified by a key.
get_all(arg1, arg2)
get_all(Brook.instance(), Brook.view_collection()) :: {:ok, %{required(Brook.view_key()) => Brook.view_value()}} | {:error, Brook.reason()}
Return all values saved to the application view state within the storage system under a given collection. Events are returned as a map with the identifying keys as keys and the saved values as values.
get_events(arg1, arg2, arg3)
get_events(Brook.instance(), Brook.view_collection(), Brook.view_key()) :: {:ok, [Brook.Event.t()]} | {:error, Brook.reason()}
Return a list of events that produced a value saved to the application view state within the storage system under a given collection and idetifying key.
get_events(arg1, arg2, arg3, arg4)
get_events( Brook.instance(), Brook.view_collection(), Brook.view_key(), Brook.event_type() ) :: {:ok, [Brook.Event.t()]} | {:error, Brook.reason()}
persist(arg1, arg2, arg3, arg4, arg5)
persist( Brook.instance(), Brook.Event.t(), Brook.view_collection(), Brook.view_key(), Brook.view_value() ) :: :ok | {:error, Brook.reason()}
Save a value from a processed event to the application view state stored on the underlying storage system. Events are saved to a collection of related events under a given identifying key.
The event is simultaneously stored under a different key to serve as a log of all events that produced or modified the value saved to the given key and collection.
start_link(list)
start_link([{:instance, Brook.instance()}]) :: GenServer.on_start()
Start the storage driver and link it to the current process.