storage

package
v3.2.40 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 16 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

func ForkOperationPlanAuthorityThreadIDs(plan ForkOperationPlan) []string

func ForkOperationPlanNodes

func ForkOperationPlanNodes(plan ForkOperationPlan) []sessiontree.ForkOptions

func ForkOperationPlanSourceThreadIDs

func ForkOperationPlanSourceThreadIDs(plan ForkOperationPlan) []string

func ValidateForkOperationCommitNodes

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

func ValidateForkOperationPlan

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

func ValidateForkOperationRecord

func ValidateForkOperationRecord(rec ForkOperationRecord) error

func ValidatePreparedForkOperation

func ValidatePreparedForkOperation(rec ForkOperationRecord) error

Types

type BackendKernel

type BackendKernel struct {
	*sessiontree.BackendRepo
	// contains filtered or unexported fields
}

BackendKernel is the single domain kernel shared by every public Backend.

func NewBackendKernel

func NewBackendKernel(ctx context.Context, backend spi.Backend, policy sessiontree.LeasePolicy, now func() time.Time) (*BackendKernel, error)

NewBackendKernel opens all canonical Floret domain state.

func (*BackendKernel) ActiveToolset

func (kernel *BackendKernel) ActiveToolset(ctx context.Context, scopeID, provider, model string) (result cache.ToolsetSnapshot, found bool, err error)

func (*BackendKernel) AppendProviderRequest

func (kernel *BackendKernel) AppendProviderRequest(ctx context.Context, value cache.ProviderRequestRecord) error

func (*BackendKernel) AppendProviderResponse

func (kernel *BackendKernel) AppendProviderResponse(ctx context.Context, value cache.ProviderResponseRecord) error

func (*BackendKernel) AppendSegment

func (kernel *BackendKernel) AppendSegment(ctx context.Context, value cache.Segment) error

func (*BackendKernel) AppendToolset

func (kernel *BackendKernel) AppendToolset(ctx context.Context, value cache.ToolsetSnapshot) error

func (*BackendKernel) Checkpoint added in v3.2.31

func (kernel *BackendKernel) Checkpoint(ctx context.Context) error

Checkpoint flushes both canonical domain state and memory-resident prompt observations during graceful shutdown or an explicit recovery barrier.

func (*BackendKernel) CommitForkOperation

func (kernel *BackendKernel) CommitForkOperation(ctx context.Context, request ForkOperationCommitRequest) (result ForkOperationRecord, replayed bool, err error)

func (*BackendKernel) DeletePromptScopes

func (kernel *BackendKernel) DeletePromptScopes(ctx context.Context, scopeIDs ...string) error

func (*BackendKernel) DeleteRootTree

func (kernel *BackendKernel) DeleteRootTree(ctx context.Context, rootThreadID string) (result sessiontree.DeleteRootTreeResult, err error)

func (*BackendKernel) FailForkOperation

func (kernel *BackendKernel) FailForkOperation(ctx context.Context, request ForkOperationFailureRequest) (result ForkOperationRecord, replayed bool, err error)

func (*BackendKernel) FinishTurn added in v3.2.31

func (kernel *BackendKernel) FinishTurn(ctx context.Context, request sessiontree.FinishTurnRequest) (result sessiontree.FinishTurnResult, err error)

FinishTurn commits the terminal semantic state and the accumulated prompt observations in one checkpoint. Prompt segments and provider diagnostics are memory-resident before this boundary so they never delay provider dispatch.

func (*BackendKernel) ForkOperation

func (kernel *BackendKernel) ForkOperation(ctx context.Context, operationID string) (result ForkOperationRecord, err error)

func (*BackendKernel) LatestPressureAnchor

func (kernel *BackendKernel) LatestPressureAnchor(ctx context.Context, scopeID, provider, model string) (result cache.PressureAnchorState, found bool, err error)

func (*BackendKernel) PrepareForkOperation

func (kernel *BackendKernel) PrepareForkOperation(ctx context.Context, record ForkOperationRecord) (result ForkOperationRecord, replayed bool, err error)

func (*BackendKernel) ProviderRequests

func (kernel *BackendKernel) ProviderRequests(ctx context.Context, scopeID string) (result []cache.ProviderRequestRecord, err error)

func (*BackendKernel) ProviderResponses

func (kernel *BackendKernel) ProviderResponses(ctx context.Context, scopeID string) (result []cache.ProviderResponseRecord, err error)

func (*BackendKernel) Segments

func (kernel *BackendKernel) Segments(ctx context.Context, scopeID, provider, model string) (result []cache.Segment, err error)

type ForkOperationCommitRequest

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

type ForkOperationFailureRequest

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

type ForkOperationPlan

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

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

type ForkOperationPlanNode

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

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

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

func (ForkOperationState) Valid

func (s ForkOperationState) Valid() bool

type MemoryForkOperationStore

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

func NewMemoryForkOperationStore

func NewMemoryForkOperationStore(authority *sessiontree.MemoryRepo) *MemoryForkOperationStore

func (*MemoryForkOperationStore) CommitForkOperation

func (*MemoryForkOperationStore) FailForkOperation

func (*MemoryForkOperationStore) ForkOperation

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

func (*MemoryForkOperationStore) PrepareForkOperation

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

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

func (*StoreLeasePolicyMismatchError) Error

type StoreSchemaIdentity

type StoreSchemaIdentity struct {
	Version     string
	Fingerprint string
}

type StoreSchemaMigrationRequirement

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

type StoreSchemaMigrationSource

type StoreSchemaMigrationSource struct {
	Identity    StoreSchemaIdentity
	Requirement StoreSchemaMigrationRequirement
}

type UnsupportedStoreSchemaError

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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