boltdbstore

package
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltDBStore

type BoltDBStore struct {
	// contains filtered or unexported fields
}

BoltDBStore is a sharded BoltDB-backed implementation of the Store and AggregateStore interfaces. Data is spread across multiple BoltDB files keyed by aggregate ID, with an index DB tracking shard assignments.

func New

func New(basePath string, pkg string, opts ...Option) (*BoltDBStore, error)

New creates a new BoltDBStore. basePath is the root directory and pkg is the subdirectory name (e.g. the aggregate package). The directory basePath/pkg/ is created if it does not exist.

func (*BoltDBStore) Close

func (s *BoltDBStore) Close() error

Close closes the index DB and all open shard DBs.

func (*BoltDBStore) Load

func (s *BoltDBStore) Load(ctx context.Context, aggregateID string) (*historyv1.History, error)

Load retrieves the event history for the given aggregate ID.

func (*BoltDBStore) LoadTail

func (s *BoltDBStore) LoadTail(ctx context.Context, aggregateID string, n int) (*historyv1.History, error)

LoadTail returns the last n events for the given aggregate, ordered by version ascending. Uses cursor.Last() and walks backwards, then reverses.

func (*BoltDBStore) Save

func (s *BoltDBStore) Save(ctx context.Context, aggregateID string, records ...*recordv1.Record) error

Save stores records for the given aggregate ID.

type Option

type Option func(*BoltDBStore)

Option configures a BoltDBStore.

func WithMaxPerShard

func WithMaxPerShard(n int) Option

WithMaxPerShard sets the maximum number of aggregate IDs per shard file. Default is 10,000.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL