Documentation
¶
Overview ¶
Package eventstore is eventing's one durable store (ADR-0201): one Badger instance holding the Sensor's dead letters under dl/<ns>/<ulid> (ADR-0118), the BlobWatcher's seen lists under seen/ (ADR-0157) and the SQL change feed's watermarks under cdc/ (ADR-0235), each tenant iterating only its own prefix. With a directory both tenants survive a restart; in memory both are lost, and the seen lists live in a MemWatermark. The store is one ADR-0202 snapshot unit: Snapshot reads both tenants at once.
Index ¶
- func MigrateSeenLists(ctx context.Context, kv kvstore.KV, s *Store) (moved int, err error)
- type ChangeWatermarks
- func (w ChangeWatermarks) Delete(_ context.Context, ns v1.NamespaceName, database v1.ObjectName) error
- func (w ChangeWatermarks) Get(_ context.Context, ns v1.NamespaceName, database v1.ObjectName, epoch string) (uint64, error)
- func (w ChangeWatermarks) Set(_ context.Context, ns v1.NamespaceName, database v1.ObjectName, epoch string, ...) error
- type Config
- type Store
- func (s *Store) ChangeWatermarks() ChangeWatermarks
- func (s *Store) Close() error
- func (s *Store) DeadLetters() deadletter.Store
- func (s *Store) Load(ctx context.Context, next func() (snapshot.Record, error)) error
- func (s *Store) SeenLists() eventing.Watermark
- func (s *Store) Snapshot(ctx context.Context, emit func(snapshot.Record) error) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MigrateSeenLists ¶
MigrateSeenLists moves the seen lists the KV holds under legacyPrefix into s (ADR-0201 Decision 6). A record with no bucket (an ADR-0119 Cursor) is skipped, and one s already holds keeps the newer list s has. Every key under the prefix is deleted only after every copy committed, so an error leaves the KV keys and the next start resumes.
Types ¶
type ChangeWatermarks ¶ added in v0.13.0
type ChangeWatermarks struct {
// contains filtered or unexported fields
}
ChangeWatermarks keeps, per database and engine epoch, the highest Raft index the change feed published.
func (ChangeWatermarks) Delete ¶ added in v0.13.0
func (w ChangeWatermarks) Delete(_ context.Context, ns v1.NamespaceName, database v1.ObjectName) error
Delete drops every epoch's watermark of a deleted database.
func (ChangeWatermarks) Get ¶ added in v0.13.0
func (w ChangeWatermarks) Get(_ context.Context, ns v1.NamespaceName, database v1.ObjectName, epoch string) (uint64, error)
Get is the watermark of (ns, database, epoch); an unknown epoch is 0.
func (ChangeWatermarks) Set ¶ added in v0.13.0
func (w ChangeWatermarks) Set(_ context.Context, ns v1.NamespaceName, database v1.ObjectName, epoch string, index uint64) error
Set records index as the watermark of (ns, database, epoch).
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the event store; DeadLetters and SeenLists are its two tenants.
func Open ¶
Open opens the event store with the dead-letter profile, and runs the value-log GC on disk.
func (*Store) ChangeWatermarks ¶ added in v0.13.0
func (s *Store) ChangeWatermarks() ChangeWatermarks
ChangeWatermarks is the cdc/ tenant, in Badger in both modes, so the store's Snapshot and Load carry it.
func (*Store) Close ¶
Close stops the GC loop, then closes the instance; the BlobWatcher and the Sensor must have stopped.
func (*Store) DeadLetters ¶
func (s *Store) DeadLetters() deadletter.Store
DeadLetters is the dl/ tenant; its Close is a no-op, the store's Close closes the instance.
func (*Store) Load ¶
Load fills an empty store from a snapshot, before its views are used (ADR-0202 Loader); a store holding a dead letter or a seen list gets fault.Conflict before any write. In memory the seen/ records go to the MemWatermark.
func (*Store) SeenLists ¶
SeenLists is the seen/ tenant: heads and parts on disk, a MemWatermark in memory.