snapshot

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package snapshot is the platform-store snapshot seam (ADR-0202): each platform store (the event store, the metastore, the run state) reads its whole content in one read transaction as a Source, and an empty store of the same port fills from such a stream as a Loader. Cut reads the three stores in the order that makes the gap between them safe; ADR-0203 writes what it emits.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cut

func Cut(ctx context.Context, events, meta, runs Source, emit func(src Source, r Record) error) (string, error)

Cut snapshots events, meta, then runs, back to back, emitting each record with its source, and returns meta's resourceVersion; the first error ends it (ADR-0202 Decision 2). A later read sees every commit an earlier one saw: a WorkflowRun in the cut has its run record, and an event fired between the reads replays rather than being lost.

Types

type Loader

type Loader interface {
	Load(ctx context.Context, next func() (Record, error)) error
}

Loader writes the records next returns, until io.EOF, in bounded batches; a non-empty store gets fault.Conflict before any write. Load is not atomic: after a failed Load the store is unusable and the caller discards it.

type Record

type Record struct{ Key, Value []byte }

Record is one entry of a store, its key and its latest value as stored.

type Source

type Source interface {
	Snapshot(ctx context.Context, emit func(Record) error) (string, error)
}

Source emits every record in key order from ONE read transaction with ONE producer and returns the store's resourceVersion at that read ("" for a store without one). An emit error ends it; emit must not call the store.

Directories

Path Synopsis
Package badger snapshots and loads a whole Badger instance for the platform stores built on one (ADR-0202), the metastore engine and the run state, so each reads in one transaction alike.
Package badger snapshots and loads a whole Badger instance for the platform stores built on one (ADR-0202), the metastore engine and the run state, so each reads in one transaction alike.
Package snapshotcontract is the shared conformance suite for snapshot.Source and snapshot.Loader (ADR-0202): every platform store runs it, on disk and in memory, so each one snapshots in one read and loads back alike.
Package snapshotcontract is the shared conformance suite for snapshot.Source and snapshot.Loader (ADR-0202): every platform store runs it, on disk and in memory, so each one snapshots in one read and loads back alike.

Jump to

Keyboard shortcuts

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