Documentation ¶
Overview ¶
Package messagestore contains interfaces used by Ax to read and write from persisted streams of messages.
The message store is the fundamental persistence type used by eventsourced sagas, though the interface is not restricted to storing events.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GloballyOrderedStore ¶
type GloballyOrderedStore interface { Store // OpenGlobal opens the entire store for reading as a single stream. // // The offset may be beyond the end of the stream. OpenGlobal( ctx context.Context, ds persistence.DataStore, offset uint64, ) (Stream, error) }
GloballyOrderedStore is a store that preserves a global ordering for messages across all streams, allowing the entire store to be consumed via a single stream.
type Store ¶
type Store interface { // AppendMessages appends one or more messages to a named stream. // // offset is a zero-based index into the stream. An error is returned if // offset is not the next unused offset in the stream. AppendMessages( ctx context.Context, tx persistence.Tx, stream string, offset uint64, envs []ax.Envelope, ) error // OpenStream opens a stream of messages for reading from a specific offset. // // The offset may be beyond the end of the stream. It returns false if the // stream does not exist. OpenStream( ctx context.Context, ds persistence.DataStore, stream string, offset uint64, ) (Stream, bool, error) }
Store is an interface for manipulating persisted streams of messages.
type Stream ¶
type Stream interface { // Next advances the stream to the next message. // // It blocks until a message is available, or ctx is canceled. Next(ctx context.Context) error // TryNext advances the stream to the next message. // // It returns false if there are no more messages in the stream. TryNext(ctx context.Context) (bool, error) // Get returns the message at the current offset in the stream. Get(ctx context.Context) (ax.Envelope, error) // Offset returns the offset of the message returned by Get(). Offset() (uint64, error) // Close closes the stream. Close() error }
Stream is an interface for reading an ordered stream of messages.
Click to show internal directories.
Click to hide internal directories.