Documentation
¶
Overview ¶
Package output owns destination acquisition and receive output contracts.
Index ¶
- Constants
- Variables
- func FailureForStage(cause error, stage FailureStage) error
- func SealFailure(cause error, diagnostic FailureDiagnostic) (error, bool)
- func SealFailures(cause error, evidence []FailureEvidence) (error, bool)
- type AttentionError
- type AttentionReason
- type Authority
- type Config
- type Factory
- type FactoryFunc
- type FailureDiagnostic
- type FailureEvidence
- type FailureStage
- type Lookup
- type LookupKind
- type NameAdjustment
- type NameAdjustmentSummary
- type Operation
- type OperationControl
- type Reservation
Constants ¶
const MaxNameAdjustmentSamples = 20
Variables ¶
var ErrBusy = errors.New("output destination or operation is already in use")
var ErrContract = errors.New("receive output authority violated its contract")
var ErrOperationAlreadyRunning = errors.New("receive output operation is already running")
var ErrOperationAmbiguous = errors.New("receive output operation ownership is ambiguous")
var ErrOperationChanged = errors.New("output operation identity no longer matches")
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 ( 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) error
SelectOperation(context.Context, transfer.SelectionSpec, receivecontract.OperationSelection) (Lookup, error)
Close() error
}
type Config ¶
type Config struct {
Diagnostics diagnostics.Sink
}
type FactoryFunc ¶
func (FactoryFunc) NewOutputAuthority ¶
func (f FactoryFunc) NewOutputAuthority(c Config) (Authority, error)
type FailureDiagnostic ¶
type FailureDiagnostic struct {
Stage FailureStage
Fault transferfault.Fault
}
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
}
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 NameAdjustment ¶ added in v0.1.6
NameAdjustment records one logical name or path saved under a compatible physical spelling: relative to the destination directory for nested items, or the destination entry name itself when the top-level root or single file was repaired.
type NameAdjustmentSummary ¶ added in v0.1.6
type NameAdjustmentSummary struct {
Count uint64
Samples []NameAdjustment
}
NameAdjustmentSummary is a bounded value snapshot of compatible-name repairs materialized by an output backend. Count is exact; Samples is capped.
func (NameAdjustmentSummary) Clone ¶ added in v0.1.6
func (summary NameAdjustmentSummary) Clone() NameAdjustmentSummary
func (NameAdjustmentSummary) Empty ¶ added in v0.1.6
func (summary NameAdjustmentSummary) Empty() bool
func (NameAdjustmentSummary) Valid ¶ added in v0.1.6
func (summary NameAdjustmentSummary) Valid() bool
type Operation ¶
type Operation struct {
Intent transfer.ReceiveIntent
Materializer transfer.DirectTreeMaterializer
Control OperationControl
// Destination is an optional provider-owned display label, never output authority.
Destination string
DestinationAdjusted bool
}
type OperationControl ¶
type OperationControl interface {
// Idle reports whether this binding still owns the operation between output sessions.
Idle() bool
Discard(context.Context) error
// NameAdjustments returns a bounded value snapshot of compatible-name
// repairs made for this operation. It remains readable after terminal close.
NameAdjustments() NameAdjustmentSummary
}
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)
}