snapshot

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Overview

Package snapshot stores periodic snapshots of execution states in KV: a cache that lets a state be rebuilt from the snapshot plus the tail of the log instead of the whole log. Snapshots are never authoritative; a missing or unreadable one just means a longer replay.

Index

Constants

View Source
const DefaultEvery = 100

DefaultEvery is the default number of events between snapshots.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store reads and writes snapshots.

func New

func New(in *infra.Infra, every int) *Store

New returns a snapshot store writing every n events (0 = DefaultEvery, negative = never).

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, execID string) error

Delete removes the snapshot of execID.

func (*Store) Due

func (s *Store) Due(before, after int) bool

Due reports whether a state that went from before to after events should be snapshotted (it crossed a multiple of the interval).

func (*Store) Load

func (s *Store) Load(ctx context.Context, execID string) (*fold.State, error)

Load returns the snapshot of execID, or nil when there is none.

func (*Store) Save

func (s *Store) Save(ctx context.Context, st *fold.State) error

Save stores st. A state larger than the claim-check threshold goes to the blobs object store with a pointer in KV, so large executions still get snapshots instead of replaying their whole log on every cache miss.

Jump to

Keyboard shortcuts

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