ledger

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 4 Imported by: 1 module, 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 ledger defines durable execution admission and recovery contracts without database or queue implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTerminalExecutionState

func IsTerminalExecutionState(state ExecutionState) bool

Types

type AtomicAdmissionStore

type AtomicAdmissionStore interface {
	ExecutionLedger
	AdmitExecutionAtomic(context.Context, DurableAdmission) (ExecutionRecord, bool, error)
}

type DurableAdmission

type DurableAdmission struct {
	Artifact        ExecutionArtifact
	Execution       ExecutionRecord
	FactApplication FactApplication
	Plans           []ExecutionPlanRecord
	Sagas           []workflow.CreateSagaRequest
	InitialSteps    []workflow.EnqueueStepRequest
}

type ExecutionArtifact

type ExecutionArtifact struct {
	GenerationDigest string
	IRDigest         string
	IRBytes          []byte
	Environment      json.RawMessage
	ExecutorManifest json.RawMessage
	FunctionManifest json.RawMessage
	SourceDigest     string
	CompilerMetadata json.RawMessage
	CreatedAt        time.Time
}

type ExecutionLease

type ExecutionLease struct {
	ExecutionID string
	Owner       string
	Token       string
	Deadline    time.Time
	Revision    uint64
}

type ExecutionLeaseRenewer added in v0.5.0

type ExecutionLeaseRenewer interface {
	RenewExecutionLease(context.Context, ExecutionLease, time.Duration) (ExecutionLease, error)
}

ExecutionLeaseRenewer extends an unexpired recovery lease without changing its owner, token, or revision. Old handles remain valid while that lease is current. Implementations must reject expired or replaced leases atomically. Recovery uses this optional capability for executions longer than one lease. Stores without it are limited to the original lease's safe execution window.

type ExecutionPlanRecord

type ExecutionPlanRecord struct {
	ExecutionID string
	PlanID      string
	SagaID      string
	Ordinal     int
	State       string
}

type ExecutionRecord

type ExecutionRecord struct {
	ExecutionID       string
	AdmissionIdentity string
	RequestHash       string
	Ruleset           string
	Version           string
	TenantNamespace   string
	MergePolicy       string
	GenerationDigest  string
	EffectiveFacts    json.RawMessage
	State             ExecutionState
	Revision          uint64
	RecoveryOwner     string
	RecoveryToken     string
	RecoveryDeadline  time.Time
	LastError         string
	CreatedAt         time.Time
	UpdatedAt         time.Time
	Plans             []ExecutionPlanRecord
}

type ExecutionState

type ExecutionState string
const (
	ExecutionAdmitting           ExecutionState = "admitting"
	ExecutionAccepted            ExecutionState = "accepted"
	ExecutionRunning             ExecutionState = "running"
	ExecutionCompleted           ExecutionState = "completed"
	ExecutionFailed              ExecutionState = "failed"
	ExecutionBlockedUnknown      ExecutionState = "blocked_unknown"
	ExecutionBlockedFence        ExecutionState = "blocked_fence"
	ExecutionBlockedDependency   ExecutionState = "blocked_dependency"
	ExecutionBlockedCompensation ExecutionState = "blocked_compensation"
)

type FactApplication

type FactApplication struct {
	ExecutionID     string
	FactEventID     string
	MergePolicy     string
	Facts           json.RawMessage
	AppliedRevision uint64
}

type RecoveryStats

type RecoveryStats struct {
	Nonterminal       int64
	Blocked           int64
	OldestNonterminal time.Time
	OldestOutbox      time.Time
}

type RecoveryStatsReader

type RecoveryStatsReader interface {
	RecoveryStats(context.Context) (RecoveryStats, error)
}

RecoveryStatsReader reports uncapped durable populations without acquiring recovery leases.

Jump to

Keyboard shortcuts

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