checkpoint

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: GPL-3.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package checkpoint owns bounded, non-secret plugin state scoped to one authenticated plugin instance generation.

Index

Constants

View Source
const (
	MaxDataBytes          = protocol.MaxCheckpointObjectBytes
	MaxAggregateDataBytes = 16 << 20
)

Variables

This section is empty.

Functions

func DefaultRoot

func DefaultRoot(configPath string) string

DefaultRoot returns the checkpoint directory beside one daemon config.

Types

type DiagnosticCode

type DiagnosticCode string

DiagnosticCode is a stable, content-free checkpoint failure category.

const (
	InvalidCode             DiagnosticCode = "checkpoint_invalid"
	CapacityCode            DiagnosticCode = "checkpoint_capacity_exceeded"
	CommitFailedCode        DiagnosticCode = "checkpoint_commit_failed"
	DurabilityUncertainCode DiagnosticCode = "checkpoint_durability_uncertain"
	CorruptCode             DiagnosticCode = "checkpoint_corrupt"
	IOFailedCode            DiagnosticCode = "checkpoint_io_failed"
)

type Error

type Error struct {
	Code    DiagnosticCode
	Outcome localstate.CommitOutcome
	Err     error
}

Error exposes a stable diagnostic and commit outcome without rendering a checkpoint identity, payload, or underlying path.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Key

type Key struct {
	PluginID   string
	InstanceID string
	Generation uint64
}

Key is the full authenticated identity for one checkpoint.

type Status

type Status struct {
	Files         int            `json:"files"`
	DataBytes     int            `json:"data_bytes"`
	Failures      uint64         `json:"failures"`
	Corruptions   uint64         `json:"corruptions"`
	LastErrorCode DiagnosticCode `json:"last_error_code,omitempty"`
}

Status is safe for daemon diagnostics. It contains counts and stable codes, never identities or checkpoint data.

type Store

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

Store serializes bounded checkpoint I/O under one lock.

func NewStore

func NewStore(root string) *Store

func (*Store) Load

func (s *Store) Load(key Key) (json.RawMessage, bool, error)

Load returns a deep copy only for an exact identity and generation. Corrupt, mismatched, and oversized files are removed and never delivered.

func (*Store) Reconcile

func (s *Store) Reconcile(active []Key) error

Reconcile removes every checkpoint not in the exact active generation set.

func (*Store) Reset

func (s *Store) Reset(key Key) error

Reset durably removes one exact checkpoint when present.

func (*Store) Save

func (s *Store) Save(key Key, data json.RawMessage) (localstate.CommitOutcome, error)

Save validates and atomically replaces one non-secret JSON checkpoint.

func (*Store) Status

func (s *Store) Status() Status

Jump to

Keyboard shortcuts

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