fileexecution

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0 modules, 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 fileexecution owns one native DirectTree file transaction. A FileCheckpointV2 is the only source of verified durable ranges.

Index

Constants

View Source
const (
	CheckpointByteLimit = 8 << 20
	CheckpointInterval  = 2 * time.Second
)
View Source
const MaximumObjectAllocationAttempts = 8

Variables

View Source
var (
	ErrInvalidConfiguration     = errors.New("file execution configuration is invalid")
	ErrInvalidClaim             = errors.New("file execution claim is invalid")
	ErrInvalidObservation       = errors.New("file execution observation is invalid")
	ErrCheckpointBinding        = errors.New("file checkpoint does not match the claimed file")
	ErrCheckpointNotInstalled   = errors.New("file checkpoint transition was not installed")
	ErrCheckpointObjectClaimed  = errors.New("file checkpoint object is already claimed by another lineage")
	ErrCheckpointRecordCapacity = errors.New("file checkpoint record capacity is exhausted")
	ErrPortContract             = errors.New("file execution collaborator contract is invalid")
	ErrObjectAllocation         = errors.New("file execution could not allocate an unclaimed object")
	ErrRangeOverlap             = errors.New("file range overlaps previously written or verified bytes")
	ErrRangeOutOfBounds         = errors.New("file range is outside the exact file size")
	ErrIncompleteFile           = errors.New("file publication requires complete verified ranges")
	ErrTransactionClosed        = errors.New("file transaction is closed")
	ErrRetirementUnauthorized   = errors.New("file retirement reason is not authorized")
	ErrRetirementAmbiguous      = errors.New("file retirement did not reach a provable ordered cut")
	ErrTargetOwnershipUnknown   = errors.New("file target ownership is unknown")
)
View Source
var ErrLiveRetentionLimit = errors.New("unfinished process-local output retention capacity exhausted")

Functions

This section is empty.

Types

type CheckpointKey

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

func (CheckpointKey) AuthorityRef

func (key CheckpointKey) AuthorityRef() receivecontract.AuthorityRef

func (CheckpointKey) CanonicalPath

func (key CheckpointKey) CanonicalPath() string

func (CheckpointKey) CheckpointLineageRequest

func (key CheckpointKey) CheckpointLineageRequest() checkpointmodel.CheckpointLineageRequest

func (CheckpointKey) CheckpointLineageSpec

func (key CheckpointKey) CheckpointLineageSpec() (checkpointmodel.CheckpointLineageSpec, error)

func (CheckpointKey) ExactSize

func (key CheckpointKey) ExactSize() uint64

func (CheckpointKey) FileID

func (key CheckpointKey) FileID() catalog.FileID

func (CheckpointKey) FileRevision

func (key CheckpointKey) FileRevision() content.FileRevision

func (CheckpointKey) MaterializationBindingDigest

func (key CheckpointKey) MaterializationBindingDigest() receivecontract.BindingDigest

func (CheckpointKey) MaterializerKind

func (key CheckpointKey) MaterializerKind() checkpointmodel.MaterializerKind

func (CheckpointKey) OperationID

func (key CheckpointKey) OperationID() receivecontract.OperationID

func (CheckpointKey) ReceiveIntentDigest

func (key CheckpointKey) ReceiveIntentDigest() transfer.ReceiveIntentDigest

type CheckpointObservation

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

func MissingCheckpoint

func MissingCheckpoint() CheckpointObservation

func ObservedCheckpoint

func ObservedCheckpoint(record checkpointmodel.Record) (CheckpointObservation, error)

func (CheckpointObservation) Record

func (observation CheckpointObservation) Record() (checkpointmodel.Record, bool)

type CheckpointRepository

type CheckpointRepository interface {
	Lookup(context.Context, CheckpointKey) (CheckpointResolution, error)
	// A nil InstallInitial error is the durability proof that permits owned-object
	// creation. A readable image accompanied by an install error is ambiguity,
	// not success, and must keep Installed false.
	InstallInitial(context.Context, CheckpointKey, checkpointmodel.Record) (InitialCheckpointObservation, error)
	// Replace must preserve every physical install error even when the requested
	// image can be reread; callers cannot advance ranges from readability alone.
	Replace(context.Context, checkpointmodel.Record, checkpointmodel.Record) (CheckpointObservation, error)
}

type CheckpointResolution

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

CheckpointResolution carries the shared closed decision while exposing a accepted record only for exact/reusable progress. Conflicts retain candidate evidence without granting receiving authority.

func (CheckpointResolution) Candidate

func (resolution CheckpointResolution) Candidate() (checkpointmodel.Record, bool)

func (CheckpointResolution) Decision

func (CheckpointResolution) Record

func (resolution CheckpointResolution) Record() (checkpointmodel.Record, bool)

type CheckpointTimer

type CheckpointTimer interface{ Stop() bool }

CheckpointTimer lets tests drive an idle flush without sleeping.

type Config

type Config struct {
	Intent      transfer.ReceiveIntent
	Ownership   checkpointmodel.Ownership
	SessionID   transfer.OutputSessionID
	Directories DirectoryAuthority
	Platform    Platform
	Checkpoints CheckpointRepository
	Random      io.Reader
	Trace       TraceSink
	Clock       func() time.Time
	AfterFunc   func(time.Duration, func()) CheckpointTimer
}

type DeliveryReceipt

type DeliveryReceipt struct {
	DescriptorDigest [sha256.Size]byte
	Object           transfer.OwnedObjectID
}

DeliveryReceipt records historical delivery only. It cannot authorize writes, deletion, or reuse of bytes in the current public namespace.

type DeliveryReceipts

DeliveryReceipts belongs to one live operation, never to restart recovery. Implementations must preserve earlier receipts when a write fails.

type Engine

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

func New

func New(config Config) (*Engine, error)

func (*Engine) BeginFile

func (engine *Engine) BeginFile(
	ctx context.Context,
	file transfer.MaterializationFile,
	destinationPath transfer.OutputDestinationPath,
) (transfer.FileStart, error)

func (*Engine) LookupDelivery

func (engine *Engine) LookupDelivery(ctx context.Context, file catalog.FileID, path string) (transfer.HistoricalDelivery, bool, error)

type FileDestination

type FileDestination interface {
	Target() transfer.FileMaterializationTarget
	ObserveFinal(context.Context, FinalExpectation) (FinalObservation, error)
	ObserveFinalPresence(context.Context) (FinalObservation, error)
	WithPublication(context.Context, OwnedFile, FinalExpectation, func(FilePublication) error) error
	Close() error
}

type FilePublication

type FilePublication interface {
	Observe(context.Context) (FinalObservation, error)
	PublishNoReplace(context.Context) (FinalObservation, error)
	Sync(context.Context) error
}

FilePublication is borrowed for one synchronous local namespace transaction. Its parent placement and owned-object binding remain valid until the callback returns. Network work and checkpoint persistence must stay outside this scope.

type FinalCondition

type FinalCondition uint8
const (
	FinalAbsent FinalCondition = iota + 1
	FinalCollision
	// Object identity and length are not authentication of current bytes.
	FinalMatchesPublication
	FinalUnsafe
)

type FinalExpectation

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

func NewFinalExpectation

func NewFinalExpectation(
	object transfer.OwnedObjectID,
	exactSize uint64,
) (FinalExpectation, error)

func (FinalExpectation) ExactSize

func (expectation FinalExpectation) ExactSize() uint64

func (FinalExpectation) ObjectIdentity

func (expectation FinalExpectation) ObjectIdentity() transfer.OwnedObjectID

type FinalObservation

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

func ObserveFinal

func ObserveFinal(condition FinalCondition) (FinalObservation, error)

func (FinalObservation) Condition

func (observation FinalObservation) Condition() FinalCondition

type InitialCheckpointObservation

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

func ObserveInitialCheckpoint

func ObserveInitialCheckpoint(
	resolution CheckpointResolution,
	installed bool,
) (InitialCheckpointObservation, error)

func (InitialCheckpointObservation) Installed

func (observation InitialCheckpointObservation) Installed() bool

func (InitialCheckpointObservation) Resolution

func (observation InitialCheckpointObservation) Resolution() CheckpointResolution

type LiveFiles

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

LiveFiles owns unfinished native objects across attempts. Completed delivery receipts have a separate lifetime and never consume native retention slots.

func NewLiveFiles

func NewLiveFiles(receipts DeliveryReceipts, intent transfer.ReceiveIntent, trace TraceSink) (*LiveFiles, error)

func (*LiveFiles) Begin

func (files *LiveFiles) Begin(
	ctx context.Context, file transfer.MaterializationFile, destination FileDestination,
	create func() (*PartialFileTransaction, error),
) (transfer.FileStart, error)

func (*LiveFiles) Close

func (files *LiveFiles) Close() error

Close removes only private stages whose handles still prove ownership. Finals and unrelated objects remain outside the cleanup authority.

type LiveOwnedFile

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

LiveOwnedFile retains a single public-profile data object. A certified cleanup ticket may outlive it; process ownership instead ends with its retained handles. Neither lifecycle can manufacture durable ranges.

func NewProcessOwnedFile

func NewProcessOwnedFile(object checkpointmodel.ObjectID, file outputcap.MutableFile, release func() error) (*LiveOwnedFile, error)

NewProcessOwnedFile retains a live native object and its resource owner without manufacturing a cleanup ticket or restart identity.

func (*LiveOwnedFile) CleanupTicket

func (file *LiveOwnedFile) CleanupTicket() checkpointmodel.LiveCleanupTicket

func (*LiveOwnedFile) Close

func (file *LiveOwnedFile) Close() error

func (*LiveOwnedFile) MetadataMatches

func (file *LiveOwnedFile) MetadataMatches(size uint64, modified catalog.ModifiedTime) (bool, error)

func (*LiveOwnedFile) NativeFile

func (file *LiveOwnedFile) NativeFile() outputcap.MutableFile

func (*LiveOwnedFile) ObjectID

func (file *LiveOwnedFile) ObjectID() checkpointmodel.ObjectID

func (*LiveOwnedFile) SetModifiedTime

func (file *LiveOwnedFile) SetModifiedTime(modified catalog.ModifiedTime) error

func (*LiveOwnedFile) Sync

func (file *LiveOwnedFile) Sync() error

func (*LiveOwnedFile) WriteAt

func (file *LiveOwnedFile) WriteAt(value []byte, offset int64) (int, error)

type MetadataWarning

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

func (MetadataWarning) Kind

func (warning MetadataWarning) Kind() MetadataWarningKind

type MetadataWarningKind

type MetadataWarningKind uint8
const MetadataModifiedTimeWarning MetadataWarningKind = iota + 1

type OwnedCondition

type OwnedCondition uint8
const (
	OwnedAbsent OwnedCondition = iota + 1
	OwnedReady
	OwnedObjectCollision
	OwnedAnchorMissing
	OwnedAnchorUnsafe
	OwnedStageMissing
	OwnedStageMismatch
	OwnedStageUnsafe
)

type OwnedFile

type OwnedFile interface {
	ObjectID() checkpointmodel.ObjectID
	WriteAt([]byte, int64) (int, error)
	Sync() error
	SetModifiedTime(catalog.ModifiedTime) error
	MetadataMatches(uint64, catalog.ModifiedTime) (bool, error)
	Close() error
}

type OwnedObservation

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

func NewOwnedObservation

func NewOwnedObservation(object checkpointmodel.ObjectID, condition OwnedCondition) (OwnedObservation, error)

func (OwnedObservation) Condition

func (observation OwnedObservation) Condition() OwnedCondition

func (OwnedObservation) ObjectID

func (observation OwnedObservation) ObjectID() checkpointmodel.ObjectID

func (OwnedObservation) ValidForCleanup

func (observation OwnedObservation) ValidForCleanup(object checkpointmodel.ObjectID) bool

type PartialFileTransaction

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

PartialFileTransaction owns both restart-durable and live-only strategies. The wrapper is the only lifecycle surfaced to outputsession, which prevents a mode-specific writer from becoming a second range/settlement framework.

func NewLivePartialFileTransaction

func NewLivePartialFileTransaction(
	file transfer.MaterializationFile,
	destination FileDestination,
	owned *LiveOwnedFile,
	cleanup func(*LiveOwnedFile) error,
) (*PartialFileTransaction, error)

func WrapPartialFileTransaction

func WrapPartialFileTransaction(strategy partialFileLifecycle) (*PartialFileTransaction, error)

func (*PartialFileTransaction) Accept

func (transaction *PartialFileTransaction) Accept(ctx context.Context) (transfer.FileProgress, error)

func (*PartialFileTransaction) Binding

func (*PartialFileTransaction) Checkpoint

func (transaction *PartialFileTransaction) Checkpoint(ctx context.Context) (transfer.VerifiedRanges, error)

func (*PartialFileTransaction) Commit

func (transaction *PartialFileTransaction) Commit(ctx context.Context) (transfer.FileSettlement, error)

func (*PartialFileTransaction) MetadataWarnings

func (transaction *PartialFileTransaction) MetadataWarnings() []MetadataWarning

func (*PartialFileTransaction) Pause

func (*PartialFileTransaction) Retire

func (*PartialFileTransaction) WriteRange

func (transaction *PartialFileTransaction) WriteRange(ctx context.Context, offset uint64, data []byte) error

type RecoveryAction

type RecoveryAction uint8
const (
	RecoveryOpenActive RecoveryAction = iota + 1
	RecoveryActivate
	RecoveryRetryPublication
	RecoveryCompletePublication
	RecoveryReturnCollision
	RecoveryReturnPublished
	RecoveryReturnRetired
	RecoveryReturnQuarantined
	RecoveryReturnOwnershipBlocked
	RecoveryInstallQuarantine
)

type RecoveryDecision

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

func ReduceRecovery

func ReduceRecovery(
	record checkpointmodel.Record,
	owned OwnedObservation,
	final FinalObservation,
) (RecoveryDecision, error)

ReduceRecovery never turns an unsafe or unclassifiable file observation into mutation authority. File-local uncertainty is durably quarantined so only the affected item stops; operation attention belongs to root/registry/lease owners.

func (RecoveryDecision) Action

func (decision RecoveryDecision) Action() RecoveryAction

func (RecoveryDecision) QuarantineReason

func (decision RecoveryDecision) QuarantineReason() checkpointmodel.QuarantineReason

type RetirementStep

type RetirementStep uint8
const (
	RetirementRemoveStage RetirementStep = iota + 1
	RetirementSyncStageNamespace
	RetirementRemoveAnchor
	RetirementSyncAnchorNamespace
)

type TraceEvent

type TraceEvent struct {
	FileID            catalog.FileID
	OperationID       receivecontract.OperationID
	IntentDigest      transfer.ReceiveIntentDigest
	SessionID         transfer.OutputSessionID
	Sequence          uint64
	Operation         TraceOperation
	Outcome           TraceOutcome
	Previous          checkpointmodel.Phase
	Next              checkpointmodel.Phase
	Decision          checkpointmodel.CheckpointLineageDecision
	Fault             fault.Fault
	RetainedLiveFiles uint64
	PreviousRevision  content.FileRevision
	CurrentRevision   content.FileRevision
	RecoveryReason    content.RevisionComparisonReason
	ReusedBytes       uint64
	RetainedBytes     uint64
}

Task and logical file identities correlate recovery decisions across restarts without making diagnostics a source of filesystem authority.

type TraceOperation

type TraceOperation uint8
const (
	TraceBeginFile TraceOperation = iota + 1
	TraceCreateOwnedFile
	TraceRecoverFile
	TraceWriteRange
	TraceCheckpoint
	TracePublish
	TracePause
	TraceRetire
	TraceItemBlocked
	TraceDeliveryReceipt
	TraceReleaseLiveFile
	TraceLiveRetention
)

type TraceOutcome

type TraceOutcome uint8
const (
	TraceSucceeded TraceOutcome = iota + 1
	TraceReconciled
	TraceCollision
	TraceNoChange
	TraceNeedsAttention
)

type TraceSink

type TraceSink interface{ TraceFileExecution(TraceEvent) }

type TraceSinkFunc

type TraceSinkFunc func(TraceEvent)

func (TraceSinkFunc) TraceFileExecution

func (function TraceSinkFunc) TraceFileExecution(event TraceEvent)

Jump to

Keyboard shortcuts

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