Documentation
¶
Overview ¶
Package fault defines the transport-neutral failure values consumed by transfer settlement policy.
Fault intentionally excludes native errors and diagnostic context. Keeping those details at the boundary that observed them prevents wrapping topology from becoming lifecycle or retirement authority.
Index ¶
- Variables
- func BoundaryCancellation(err error) error
- func Compare(left, right Fault) int
- func ReduceBoundaryErrorSet(candidates ...error) error
- func ReduceBoundaryErrors(ctx context.Context, candidates ...error) error
- func Wrap(fault Fault, cause error) error
- type BoundaryError
- type BoundaryResult
- type BoundaryResultKind
- type CatalogCode
- type CheckpointCode
- type Domain
- type Fault
- func DependencyContractFault() Fault
- func Join(faults ...Fault) Fault
- func NewCatalog(scope Scope, code CatalogCode) (Fault, error)
- func NewCheckpoint(scope Scope, code CheckpointCode) (Fault, error)
- func NewOutput(scope Scope, code OutputCode) (Fault, error)
- func NewSession(scope Scope, code SessionCode) (Fault, error)
- func NewSource(scope Scope, code SourceCode) (Fault, error)
- func (fault Fault) CatalogCode() (CatalogCode, bool)
- func (fault Fault) CheckpointCode() (CheckpointCode, bool)
- func (fault Fault) Code() uint16
- func (fault Fault) Domain() Domain
- func (fault Fault) IsZero() bool
- func (fault Fault) OutputCode() (OutputCode, bool)
- func (fault Fault) Scope() Scope
- func (fault Fault) SessionCode() (SessionCode, bool)
- func (fault Fault) SourceCode() (SourceCode, bool)
- func (fault Fault) String() string
- func (fault Fault) Valid() bool
- type OutputCode
- type Retirement
- type Scope
- type SessionCode
- type SourceCode
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidFault = errors.New("transfer fault is invalid")
Functions ¶
func BoundaryCancellation ¶
BoundaryCancellation returns a standard cancellation sentinel only for an unclassified collaborator result. A classified fault owns its outcome; its diagnostics cannot grant cancellation authority. Callers check their own context first, independently of the collaborator's result.
func Compare ¶
Compare establishes a total order for deterministic reduction. Domain and code break equal-severity ties only; their order does not grant extra policy authority to one collaborator.
func ReduceBoundaryErrorSet ¶
ReduceBoundaryErrorSet joins already-completed sibling results when no operation context exists. It preserves explicit cancellation outside the fault lattice and applies the same total Fault join as the context-aware form.
func ReduceBoundaryErrors ¶
ReduceBoundaryErrors combines immediate sibling collaborator results without deriving policy from their aggregate error topology. Each candidate is normalized once, Fault values use the total deterministic join, and any cancellation remains outside the fault lattice.
Types ¶
type BoundaryError ¶
type BoundaryError struct {
// contains filtered or unexported fields
}
BoundaryError is the standard typed handoff from a collaborator adapter. Its cause remains available at that immediate boundary for diagnostics only.
func (*BoundaryError) Error ¶
func (failure *BoundaryError) Error() string
func (*BoundaryError) Fault ¶
func (failure *BoundaryError) Fault() Fault
func (*BoundaryError) Unwrap ¶
func (failure *BoundaryError) Unwrap() error
type BoundaryResult ¶
type BoundaryResult struct {
// contains filtered or unexported fields
}
BoundaryResult is a closed normalization result. It cannot carry the raw cause, so settlement code receives no error graph to reinterpret.
func NormalizeBoundary ¶
func NormalizeBoundary(ctx context.Context, err error) BoundaryResult
NormalizeBoundary checks caller cancellation before accepting a typed collaborator fault. An unknown error is a local dependency-contract breach and therefore pauses output authority rather than acquiring file isolation or retirement authority.
func NormalizeBoundaryError ¶
func NormalizeBoundaryError(err error) BoundaryResult
NormalizeBoundaryError is the context-free form for a completed collaborator result. Keeping it separate prevents locked invariant and trace paths from inventing a context while retaining unclassified collaborator cancellation.
func (BoundaryResult) Fault ¶
func (result BoundaryResult) Fault() (Fault, bool)
func (BoundaryResult) Kind ¶
func (result BoundaryResult) Kind() BoundaryResultKind
type BoundaryResultKind ¶
type BoundaryResultKind uint8
const ( BoundarySuccess BoundaryResultKind = iota BoundaryCanceled BoundaryFailed )
type CatalogCode ¶
type CatalogCode uint16
const ( CatalogDirectoryStale CatalogInvalidGeneration )
func (CatalogCode) String ¶
func (code CatalogCode) String() string
type CheckpointCode ¶
type CheckpointCode uint16
const ( CheckpointBusy CheckpointCode = iota + 1 CheckpointCorruptRecord CheckpointUnsafeInstall CheckpointOwnershipMismatch CheckpointStateIO )
func (CheckpointCode) String ¶
func (code CheckpointCode) String() string
type Fault ¶
type Fault struct {
// contains filtered or unexported fields
}
Fault is an immutable, comparable policy value. Scope is deliberately not inferred from Code: the stable-cut evidence at a boundary decides whether an otherwise identical failure is isolated or requires pausing wider authority.
func DependencyContractFault ¶
func DependencyContractFault() Fault
func Join ¶
Join returns the maximum normalized fault and treats the zero value as the identity. Constructors are the only way external packages can create a non-zero Fault, so invalid values cannot silently enter policy reduction.
func NewCatalog ¶
func NewCatalog(scope Scope, code CatalogCode) (Fault, error)
func NewCheckpoint ¶
func NewCheckpoint(scope Scope, code CheckpointCode) (Fault, error)
func NewSession ¶
func NewSession(scope Scope, code SessionCode) (Fault, error)
func (Fault) CatalogCode ¶
func (fault Fault) CatalogCode() (CatalogCode, bool)
func (Fault) CheckpointCode ¶
func (fault Fault) CheckpointCode() (CheckpointCode, bool)
func (Fault) OutputCode ¶
func (fault Fault) OutputCode() (OutputCode, bool)
func (Fault) SessionCode ¶
func (fault Fault) SessionCode() (SessionCode, bool)
func (Fault) SourceCode ¶
func (fault Fault) SourceCode() (SourceCode, bool)
type OutputCode ¶
type OutputCode uint16
const ( OutputStateIO OutputCode = iota + 1 OutputOwnership OutputNamespaceUnsafe OutputUnsupportedFilesystem OutputDirectoryBinding OutputDirectoryMetadata OutputFileAlreadyActive OutputResourceBudget OutputMutationAmbiguous OutputContract )
func (OutputCode) String ¶
func (code OutputCode) String() string
type Retirement ¶
type Retirement uint8
const ( RetirementPermanentSource Retirement = iota + 1 RetirementInvalidatedRevision )
func RetirementFor ¶
func RetirementFor(fault Fault) (Retirement, bool)
RetirementFor is an explicit allowlist. Severity alone never permits state deletion, and the file-local check prevents a wider source failure from being repurposed as authority over one file.
type Scope ¶
type Scope uint8
Scope is also the severity order used by Join. The numeric order is frozen so Go and browser runtimes reduce sibling failures identically.
type SessionCode ¶
type SessionCode uint16
const ( SessionTransport SessionCode = iota + 1 SessionProtocol SessionResourceBudget SessionDependencyContract )
func (SessionCode) String ¶
func (code SessionCode) String() string
type SourceCode ¶
type SourceCode uint16
const ( SourceRevisionChanged SourceRevisionInvalidated SourcePermanent )
func (SourceCode) String ¶
func (code SourceCode) String() string