output

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: AGPL-3.0 Imports: 7 Imported by: 1 module, 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 output owns destination acquisition and receive output contracts.

Index

Constants

This section is empty.

Variables

View Source
var ErrBusy = errors.New("output destination or operation is already in use")
View Source
var ErrContract = errors.New("receive output authority violated its contract")
View Source
var ErrShareStopped = errors.New("retained output belongs to a stopped share")

Functions

func FailureForStage

func FailureForStage(cause error, stage FailureStage) error

Joined primary and release failures are independent facts. Selecting cleanup must never retain an unrelated primary failure or lose a second close failure.

func SealFailure

func SealFailure(cause error, diagnostic FailureDiagnostic) (error, bool)

func SealFailures

func SealFailures(cause error, evidence []FailureEvidence) (error, bool)

SealFailures retains the original error while identifying exactly which cause belongs to each stage. A close annotation must never claim unrelated work.

Types

type AttentionError

type AttentionError struct{ Reason AttentionReason }

AttentionError preserves an admission reason through application settlement.

func (*AttentionError) Error

func (err *AttentionError) Error() string

type AttentionReason

type AttentionReason string
const (
	AttentionRecoveryUnavailable AttentionReason = "recovery-unavailable"
	AttentionNone                AttentionReason = ""
	AttentionDestination         AttentionReason = "destination-ownership-unknown"
	AttentionRegistry            AttentionReason = "registry-ownership-unknown"
	AttentionLease               AttentionReason = "lease-ownership-unknown"
	AttentionOperation           AttentionReason = "operation-ownership-unknown"
	AttentionCleanup             AttentionReason = "cleanup-uncertain"
)

func (AttentionReason) Valid

func (reason AttentionReason) Valid() bool

type Authority

type Authority interface {
	BindDestination(context.Context) (Mode, error)
	SelectOperation(context.Context, transfer.SelectionSpec, receivecontract.OperationSelection) (Lookup, error)
	Close() error
}

type CompatibleNameReport added in v0.1.5

type CompatibleNameReport struct {
	RepairedCount uint64
	ReportName    string
	PageCount     uint64
}

CompatibleNameReport records compatible-name repairs exported beside a destination when a receive operation settles or is discarded. Either all fields are populated or all are zero.

func (CompatibleNameReport) Empty added in v0.1.5

func (report CompatibleNameReport) Empty() bool

func (CompatibleNameReport) Valid added in v0.1.5

func (report CompatibleNameReport) Valid() bool

type Config

type Config struct {
	Diagnostics diagnostics.Sink
}

type Factory

type Factory interface {
	NewOutputAuthority(Config) (Authority, error)
}

type FactoryFunc

type FactoryFunc func(Config) (Authority, error)

func (FactoryFunc) NewOutputAuthority

func (f FactoryFunc) NewOutputAuthority(c Config) (Authority, error)

type FailureDiagnostic

type FailureDiagnostic struct {
	Stage   FailureStage
	Failure observation.Failure
}

func DiagnosticFor

func DiagnosticFor(cause error) (FailureDiagnostic, bool)

func FindDiagnostic

func FindDiagnostic(cause error) (FailureDiagnostic, bool)

FindDiagnostic reads the first explicit application annotation in cause order. It is used for action selection; it does not infer provider-specific stages.

func (FailureDiagnostic) Valid

func (diagnostic FailureDiagnostic) Valid() bool

type FailureEvidence

type FailureEvidence struct {
	Cause      error
	Diagnostic FailureDiagnostic
}

FailureEvidence binds one stage to its exact causes, so cleanup failures can be selected without retaining unrelated work from the original error tree.

type FailureStage

type FailureStage uint8

FailureStage describes the application operation that failed, independently of the provider's persistence primitives or native error vocabulary.

const (
	FailureDestinationBinding FailureStage = iota + 1
	FailureInventory
	FailureLookup
	FailureOpen
	FailureCreate
	FailureCheckpoint
	FailureDurability
	FailureClose
)

func (FailureStage) String

func (stage FailureStage) String() string

func (FailureStage) Valid

func (stage FailureStage) Valid() bool

type Lookup

type Lookup struct {
	Attention   AttentionReason
	Kind        LookupKind
	Operation   Operation
	Reservation Reservation
}

func (Lookup) Valid

func (lookup Lookup) Valid() bool

type LookupKind

type LookupKind uint8

A missing explicit selection cannot acquire permission to create a new download. Only CreateReady carries that reservation authority.

const (
	OutputLookupCreateReady LookupKind = iota + 1
	OutputLookupNotFound
	OutputLookupReopened
	OutputLookupAlreadyRunning
	OutputLookupNeedsAttention
	OutputLookupAmbiguous
)

type Mode

type Mode uint8
const (
	OutputResumable Mode = iota + 1
	OutputLiveOnly
)

func (Mode) Valid

func (mode Mode) Valid() bool

type Operation

type Operation struct {
	Intent       transfer.ReceiveIntent
	Mode         Mode
	Materializer transfer.DirectTreeMaterializer
	Control      OperationControl
	// Destination is an optional provider-owned display label, never output authority.
	Destination         string
	DestinationAdjusted bool
}

func (Operation) Valid

func (o Operation) Valid() bool

type OperationControl

type OperationControl interface {
	// Idle reports whether this binding still owns the operation between output sessions.
	Idle() bool
	RecordShareStopped(context.Context) error
	Discard(context.Context) error
	// CompatibleNameReport reports any compatible-name repairs exported when the
	// operation settles or is discarded. It remains readable after terminal close
	// because it holds only values.
	CompatibleNameReport() CompatibleNameReport
}

Operation couples immutable intent with the authority that can open it. It does not expose a filesystem path or a provider-specific operation handle.

type Reservation

type Reservation interface {
	Create(context.Context, receivecontract.ArtifactSpec) (Operation, error)
}

Jump to

Keyboard shortcuts

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