actionpersistence

package
v0.3.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package actionpersistence defines the framework-owned persistence boundary used by the Action runtime and official storage adapters.

Index

Constants

This section is empty.

Variables

View Source
var ErrPlanNotFound = errors.New("action plan not found")

ErrPlanNotFound identifies a missing plan in a PlanStore.

Functions

func ValidateIdempotencyCompletionRecord

func ValidateIdempotencyCompletionRecord(record IdempotencyRecord) error

ValidateIdempotencyCompletionRecord validates a completed idempotency record and its replayable result.

func ValidateIdempotencyLookupRecord

func ValidateIdempotencyLookupRecord(record IdempotencyRecord) error

ValidateIdempotencyLookupRecord validates the identity fields used to look up one idempotency binding. PlanHash may be empty before planning.

func ValidateIdempotencyReservationRecord

func ValidateIdempotencyReservationRecord(record IdempotencyRecord) error

ValidateIdempotencyReservationRecord validates a running idempotency record.

func ValidatePlanRecord

func ValidatePlanRecord(plan action.Plan) error

ValidatePlanRecord validates the portable persistence contract for a Plan. It validates provenance shape, bounded policy fields, JSON, and canonical UTC timestamps; Runtime separately verifies that Hash matches the plan material.

func ValidateStoredIdempotencyRecord

func ValidateStoredIdempotencyRecord(record IdempotencyRecord) error

ValidateStoredIdempotencyRecord validates either durable lifecycle state.

Types

type IdempotencyRecord

type IdempotencyRecord struct {
	Scope               scope.Execution
	ActorID             string
	ActorType           string
	ActionID            string
	ActionVersion       string
	ContractHash        string
	Channel             action.Channel
	Key                 string
	InputHash           string
	PlanHash            string
	Impact              authz.Impact
	DecisionFingerprint string
	Status              IdempotencyStatus
	Result              action.Result
}

IdempotencyRecord binds a caller key to one exact Action execution and its result.

type IdempotencyStatus

type IdempotencyStatus string

IdempotencyStatus identifies the lifecycle state of an idempotency record.

const (
	// IdempotencyRunning marks a reserved execution that has not completed.
	IdempotencyRunning IdempotencyStatus = "running"
	// IdempotencyCompleted marks an execution with a durable stored Result.
	IdempotencyCompleted IdempotencyStatus = "completed"
)

type IdempotencyStore

type IdempotencyStore interface {
	Lookup(context.Context, IdempotencyRecord) (existing *IdempotencyRecord, err error)
	Reserve(context.Context, IdempotencyRecord) (existing *IdempotencyRecord, err error)
	Complete(context.Context, IdempotencyRecord) error
	Abort(context.Context, IdempotencyRecord) error
}

IdempotencyStore looks up, reserves, completes, and aborts execution records using the transaction-aware context supplied by Runtime. Store errors are operational dependency failures.

type PlanStore

type PlanStore interface {
	Save(context.Context, action.Plan) error
	Get(context.Context, string) (action.Plan, error)
	DeleteExpired(context.Context, time.Time) (int64, error)
}

PlanStore stores Preview plans. Get must wrap ErrPlanNotFound when hash is absent. Every other store error is an operational dependency failure.

Jump to

Keyboard shortcuts

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