Documentation ¶
Index ¶
- type JournalStore
- func (s *JournalStore) Connect(ctx context.Context) error
- func (s *JournalStore) DeleteJournals(ctx context.Context, persistenceID string, toSequenceNumber uint64) error
- func (s *JournalStore) Disconnect(ctx context.Context) error
- func (s *JournalStore) GetLatestJournal(ctx context.Context, persistenceID string) (*local.Journal, error)
- func (s *JournalStore) PersistJournals(ctx context.Context, journals []*local.Journal) error
- func (s *JournalStore) PersistenceIDs(ctx context.Context) (persistenceIDs []string, err error)
- func (s *JournalStore) Ping(ctx context.Context) error
- func (s *JournalStore) ReplayJournals(ctx context.Context, persistenceID string, ...) ([]*local.Journal, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JournalStore ¶
type JournalStore struct { // this is only useful for tests KeepRecordsAfterDisconnect bool // contains filtered or unexported fields }
JournalStore keep in memory every journal NOTE: NOT RECOMMENDED FOR PRODUCTION CODE because all records are in memory and there is no durability. This is recommended for tests or PoC
func NewJournalStore ¶
func NewJournalStore() *JournalStore
NewJournalStore creates a new instance of MemoryEventStore
func (*JournalStore) Connect ¶
func (s *JournalStore) Connect(ctx context.Context) error
Connect connects to the journal store
func (*JournalStore) DeleteJournals ¶
func (s *JournalStore) DeleteJournals(ctx context.Context, persistenceID string, toSequenceNumber uint64) error
DeleteJournals deletes events from the store upt to a given sequence number (inclusive) FIXME: enhance the implementation. As it stands it may be a bit slow
func (*JournalStore) Disconnect ¶
func (s *JournalStore) Disconnect(ctx context.Context) error
Disconnect disconnect the journal store
func (*JournalStore) GetLatestJournal ¶
func (s *JournalStore) GetLatestJournal(ctx context.Context, persistenceID string) (*local.Journal, error)
GetLatestJournal fetches the latest event
func (*JournalStore) PersistJournals ¶
PersistJournals persist journal in batches for a given persistenceID
func (*JournalStore) PersistenceIDs ¶
func (s *JournalStore) PersistenceIDs(ctx context.Context) (persistenceIDs []string, err error)
PersistenceIDs returns the distinct list of all the persistence ids in the journal store
func (*JournalStore) Ping ¶
func (s *JournalStore) Ping(ctx context.Context) error
Ping verifies a connection to the database is still alive, establishing a connection if necessary.
func (*JournalStore) ReplayJournals ¶
func (s *JournalStore) ReplayJournals(ctx context.Context, persistenceID string, fromSequenceNumber, toSequenceNumber uint64, max uint64) ([]*local.Journal, error)
ReplayJournals fetches events for a given persistence ID from a given sequence number(inclusive) to a given sequence number(inclusive)