brook v0.4.1 Brook.Event.Handler behaviour
Defines the Brook.Event.Handler
behaviour that an application
is expected to provide for processing events off the event stream via
Brook, as well as a default implementation.
Link to this section Summary
Types
The return value of a create operation to save a value to the view state
The return value of a delete operation to remove a value from the view state
The return value of an event that should not persist any result to the view state.
The return value of merging a new value into the existing value with the view state saved under a given key and collection.
Functions
Simple default handle_event/1
implementation that discards the message and
takes no other action.
A using macro to define a module as implementing the Brook.Event.Handler
behaviour
and supply a default implementation of the required handle_event/1
function.
Callbacks
Process incoming events from the event stream and return a result with optional persistence of values to the application view state.
Link to this section Types
create()
create() ::
{:create, Brook.view_collection(), Brook.view_key(), Brook.view_value()}
create() :: {:create, Brook.view_collection(), Brook.view_key(), Brook.view_value()}
The return value of a create operation to save a value to the view state
delete()
delete() :: {:delete, Brook.view_collection(), Brook.view_key()}
delete() :: {:delete, Brook.view_collection(), Brook.view_key()}
The return value of a delete operation to remove a value from the view state
discard()
discard() :: :discard
discard() :: :discard
The return value of an event that should not persist any result to the view state.
merge()
merge() ::
{:merge, Brook.view_collection(), Brook.view_key(), Brook.view_value()}
merge() :: {:merge, Brook.view_collection(), Brook.view_key(), Brook.view_value()}
The return value of merging a new value into the existing value with the view state saved under a given key and collection.
Link to this section Functions
__before_compile__(env) (macro)
Simple default handle_event/1
implementation that discards the message and
takes no other action.
__using__(opts) (macro)
A using macro to define a module as implementing the Brook.Event.Handler
behaviour
and supply a default implementation of the required handle_event/1
function.
Link to this section Callbacks
handle_event(arg1)
handle_event(Brook.Event.t()) :: create() | delete() | merge() | discard()
handle_event(Brook.Event.t()) :: create() | delete() | merge() | discard()
Process incoming events from the event stream and return a result with optional persistence of values to the application view state.