ledger

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 4 Imported by: 0

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 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