eventstore v0.0.5 EventStore
EventStore client API to read and write events to a logical event stream
Each of the following client functions expects to receive an already started & initialised EventStore.Storage
pid.
Example usage
{:ok, store} = EventStore.Storage.start_link
EventStore.Storage.initialize_store!(store)
Summary
Functions
Append one or more events to a stream atomically
Reads the requested number of events from the given stream, in the order in which they were originally written
Subscriber will be notified of each persisted event after the subscription is established
Functions
Append one or more events to a stream atomically.
storage
an already startedEventStore.Storage
pid.stream_uuid
is used to uniquely identify a stream. It should be a UUID string of exactly 36 characters.expected_version
is used for optimistic concurrency. Specify 0 for the creation of a new stream. An{:error, wrong_expected_version}
response will be returned if the stream already exists. Any positive number will be used to ensure you can only append to the stream if it is at exactly that version.events
is a list of%EventStore.EventData{}
structs
Reads the requested number of events from the given stream, in the order in which they were originally written.
storage
an already startedEventStore.Storage
pid.stream_uuid
is used to uniquely identify a stream. It should be a UUID string of exactly 36 characters.start_version
the version number of the first event to readcount
optionally, the maximum number of events to read. If not set it will return all events from the stream.
Subscriber will be notified of each persisted event after the subscription is established.
subscriptions
an already startedEventStore.Subscriptions.Supervisor
pid.stream_uuid
is the stream to subscribe to. Use the$all
identifier to subscribe to events from all streams.subscription_name
is used to name the subscription group.subscriber
is a process that will receive{:event, event}
callback messages.Returns
{:ok, subscription}
when subscription succeeds.