Documentation ¶
Overview ¶
Package messagestore provides MySQL-specific implementations of the interfaces in Ax's top-level "messagestore" package.
Index ¶
- Constants
- type Fetcher
- type GlobalFetcher
- type Store
- func (Store) AppendMessages(ctx context.Context, ptx persistence.Tx, stream string, offset uint64, ...) error
- func (Store) OpenGlobal(ctx context.Context, ds persistence.DataStore, offset uint64) (messagestore.Stream, error)
- func (Store) OpenStream(ctx context.Context, ds persistence.DataStore, stream string, offset uint64) (messagestore.Stream, bool, error)
- type Stream
- type StreamFetcher
Constants ¶
const ( // DefaultFetchLimit is the number of messages to fetch in each select query on // a message stream. DefaultFetchLimit = 100 // DefaultPollInterval is the default time to wait between polls in // MessageStream.Next(). DefaultPollInterval = 500 * time.Millisecond )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fetcher ¶
type Fetcher interface { // FetchRows fetches the n rows beginning at the given offset. FetchRows(ctx context.Context, offset, n uint64) (*sql.Rows, error) }
Fetcher is an interface for fetching rows from the message store
type GlobalFetcher ¶
GlobalFetcher is a fetcher that fetches rows for the entire store
type Store ¶
type Store struct{}
Store is a MySQL-backed implementation of Ax's messagestore.GloballyOrderedStore interface.
func (Store) AppendMessages ¶
func (Store) AppendMessages( ctx context.Context, ptx persistence.Tx, stream string, offset uint64, envs []ax.Envelope, ) error
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.
func (Store) OpenGlobal ¶
func (Store) OpenGlobal( ctx context.Context, ds persistence.DataStore, offset uint64, ) (messagestore.Stream, error)
OpenGlobal opens the entire store for reading as a single stream.
The offset may be beyond the end of the stream.
func (Store) OpenStream ¶
func (Store) OpenStream( ctx context.Context, ds persistence.DataStore, stream string, offset uint64, ) (messagestore.Stream, bool, error)
OpenStream opens a stream of messages for reading from a specific offset.
The offset may be past the end of the stream. It returns false if the stream does not exist.
type Stream ¶
type Stream struct { Fetcher Fetcher NextOffset uint64 Limit uint64 PollInterval time.Duration // contains filtered or unexported fields }
Stream is a MySQL-backed implementation of Ax's messagestore.Stream interface.
func (*Stream) Next ¶
Next advances the stream to the next message.
It blocks until a message is available, or ctx is canceled.
type StreamFetcher ¶
StreamFetcher is a fetcher that fetches rows for a specific stream.