storage

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ForkOperationPlanVersion = 5

Variables

View Source
var (
	ErrForkOperationNotFound = errors.New("fork operation not found")
	ErrForkOperationConflict = errors.New("fork operation conflicts with existing record")
)
View Source
var ErrMetadataNotFound = errors.New("storage metadata not found")

Functions

func ForkOperationPlanAuthorityThreadIDs added in v0.18.0

func ForkOperationPlanAuthorityThreadIDs(plan ForkOperationPlan) []string

func ForkOperationPlanNodes added in v0.18.0

func ForkOperationPlanNodes(plan ForkOperationPlan) []sessiontree.ForkOptions

func ForkOperationPlanSourceThreadIDs added in v0.18.0

func ForkOperationPlanSourceThreadIDs(plan ForkOperationPlan) []string

func ValidateForkOperationCommitNodes added in v0.18.0

func ValidateForkOperationCommitNodes(plan ForkOperationPlan, nodes []sessiontree.ForkOptions) error

func ValidateForkOperationPlan added in v0.18.0

func ValidateForkOperationPlan(plan ForkOperationPlan, operationID, fingerprint string) error

func ValidateForkOperationRecord added in v0.5.0

func ValidateForkOperationRecord(rec ForkOperationRecord) error

func ValidatePreparedForkOperation added in v0.5.0

func ValidatePreparedForkOperation(rec ForkOperationRecord) error

Types

type ForkOperationCommitRequest added in v0.18.0

type ForkOperationCommitRequest struct {
	OperationID        string
	RequestFingerprint string
	Plan               json.RawMessage
	Nodes              []sessiontree.ForkOptions
	Result             json.RawMessage
	FinishedAt         time.Time
}

type ForkOperationFailureRequest added in v0.18.0

type ForkOperationFailureRequest struct {
	OperationID        string
	RequestFingerprint string
	ErrorCode          string
	ErrorMessage       string
	FinishedAt         time.Time
}

type ForkOperationPlan added in v0.18.0

type ForkOperationPlan struct {
	Version            int                     `json:"version"`
	OperationID        string                  `json:"operation_id"`
	RequestFingerprint string                  `json:"request_fingerprint"`
	PreparedAt         time.Time               `json:"prepared_at"`
	Root               ForkOperationPlanNode   `json:"root"`
	TerminalChildren   []ForkOperationPlanNode `json:"terminal_children,omitempty"`
}

func DecodeForkOperationPlan added in v0.18.0

func DecodeForkOperationPlan(data json.RawMessage) (ForkOperationPlan, error)

type ForkOperationPlanNode added in v0.18.0

type ForkOperationPlanNode struct {
	NodeID              string                           `json:"node_id"`
	SourceThreadID      string                           `json:"source_thread_id"`
	SourceEntryID       string                           `json:"source_entry_id,omitempty"`
	SourceLeafEntryID   string                           `json:"source_leaf_entry_id,omitempty"`
	DestinationThreadID string                           `json:"destination_thread_id"`
	TurnIDMap           map[string]string                `json:"turn_id_map,omitempty"`
	RunIDMap            map[string]string                `json:"run_id_map,omitempty"`
	DestinationMeta     *sessiontree.ForkDestinationMeta `json:"destination_meta,omitempty"`
	ArtifactClosure     artifact.Closure                 `json:"artifact_closure"`
}

type ForkOperationRecord added in v0.5.0

type ForkOperationRecord struct {
	OperationID        string
	RequestFingerprint string
	SourceThreadIDs    []string
	AuthorityThreadIDs []string
	State              ForkOperationState
	Plan               json.RawMessage
	Result             json.RawMessage
	ErrorCode          string
	ErrorMessage       string
	CreatedAt          time.Time
	UpdatedAt          time.Time
	FinishedAt         time.Time
}

type ForkOperationState added in v0.5.0

type ForkOperationState string
const (
	ForkOperationPrepared  ForkOperationState = "prepared"
	ForkOperationCompleted ForkOperationState = "completed"
	ForkOperationFailed    ForkOperationState = "failed"
)

func (ForkOperationState) Valid added in v0.5.0

func (s ForkOperationState) Valid() bool

type ForkOperationStore added in v0.5.0

type MemoryForkOperationStore added in v0.5.0

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

func NewMemoryForkOperationStore added in v0.5.0

func NewMemoryForkOperationStore(authority *sessiontree.MemoryRepo) *MemoryForkOperationStore

func (*MemoryForkOperationStore) CommitForkOperation added in v0.18.0

func (*MemoryForkOperationStore) FailForkOperation added in v0.18.0

func (*MemoryForkOperationStore) ForkOperation added in v0.5.0

func (s *MemoryForkOperationStore) ForkOperation(_ context.Context, operationID string) (ForkOperationRecord, error)

func (*MemoryForkOperationStore) PrepareForkOperation added in v0.5.0

type MetadataRecord

type MetadataRecord struct {
	Namespace string
	ID        string
	CreatedAt time.Time
	UpdatedAt time.Time
	Data      json.RawMessage
}

type MetadataStore

type MetadataStore interface {
	PutMetadata(context.Context, MetadataRecord) error
	Metadata(context.Context, string, string) (MetadataRecord, error)
	ListMetadata(context.Context, string) ([]MetadataRecord, error)
	DeleteMetadata(context.Context, string, string) error
}

type StoreLeasePolicyMismatchError added in v0.18.0

type StoreLeasePolicyMismatchError struct {
	Configured sessiontree.LeasePolicy
	Persisted  sessiontree.LeasePolicy
}

func (*StoreLeasePolicyMismatchError) Error added in v0.18.0

type StoreSchemaIdentity added in v0.26.0

type StoreSchemaIdentity struct {
	Version     string
	Fingerprint string
}

type StoreSchemaMigrationRequirement added in v0.26.0

type StoreSchemaMigrationRequirement string
const (
	StoreSchemaMigrationRequirementNone               StoreSchemaMigrationRequirement = "none"
	StoreSchemaMigrationRequirementQuiescentAuthority StoreSchemaMigrationRequirement = "quiescent_authority"
)

type StoreSchemaMigrationSource added in v0.26.0

type StoreSchemaMigrationSource struct {
	Identity    StoreSchemaIdentity
	Requirement StoreSchemaMigrationRequirement
}

type UnsupportedStoreSchemaError added in v0.18.0

type UnsupportedStoreSchemaError struct {
	Observed   StoreSchemaIdentity
	Current    StoreSchemaIdentity
	Migratable []StoreSchemaMigrationSource
}

UnsupportedStoreSchemaError reports an exact schema contract mismatch. Store open must return this error without modifying the observed database.

func (*UnsupportedStoreSchemaError) Error added in v0.18.0

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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