Documentation
¶
Overview ¶
Package outputcap defines the native capabilities consumed by the incremental output runtime. Keeping these contracts below osfs lets platform implementations depend on capability semantics without depending on the state-machine package that orchestrates them.
Index ¶
- Constants
- Variables
- type CapabilityEvidence
- type CapabilityFact
- type CapabilityReason
- type CreateAuthorityValidator
- type CurrentEntryReference
- type DestinationBindingID
- type DestinationCapabilities
- func (capabilities DestinationCapabilities) CrashCleanup() CapabilityEvidence
- func (capabilities DestinationCapabilities) OperationRecovery() CapabilityEvidence
- func (capabilities DestinationCapabilities) RangeRecovery() CapabilityEvidence
- func (capabilities DestinationCapabilities) SafePublish() CapabilityEvidence
- func (capabilities DestinationCapabilities) Valid() bool
- type Directory
- type DirectoryNameBatch
- type EntryKind
- type ExecutionMode
- type FileIdentity
- type IdentitySchemeID
- type Lock
- type MetadataAuthorityValidator
- type MutableFile
- type NativeErrorCarrier
- type NativeErrorClass
- type ObservedFile
- type OutputRootBinding
- type Platform
- type PublicEntryNamesValidator
- type PublicOperationGuard
- type PublishNoReplaceOutcome
- type RecoveryDurabilityFile
- type RootOpenDisposition
Constants ¶
const ( ExecutionModeResumable = ExecutionResumable ExecutionModeLiveOnly = ExecutionLiveOnly )
const ( PublishCommitted = PublishNoReplaceCommitted PublishCollision = PublishNoReplaceCollision PublishIndeterminate = PublishNoReplaceIndeterminate )
const ( CallerProvidedContainer = checkpointmodel.CallerProvidedContainer AuthorityCreatedRoot = checkpointmodel.AuthorityCreatedRoot )
const ( OutputRootBindingBytes = sha256.Size DestinationBindingIDBytes = sha256.Size MaxRootIdentityClaimBytes = 256 MaxNamespaceIdentityClaimBytes = 256 DestinationBindingIDDomainV1 = "windshare/destination-authority-id/v1" )
const ( IdentitySchemeLinuxHandleV2 = checkpointmodel.IdentitySchemeLinuxHandleV2 IdentitySchemeWindowsObjectIDV1 = checkpointmodel.IdentitySchemeWindowsObjectIDV1 IdentitySchemeDarwinObjectIDV1 = checkpointmodel.IdentitySchemeDarwinObjectIDV1 IdentitySchemePortableWitnessV1 = checkpointmodel.IdentitySchemePortableWitnessV1 )
Variables ¶
var ( ErrInvalidDestinationCapabilities = errors.New("osfs: destination capabilities are invalid") ErrOrdinaryOutputUnsupported = errors.New("osfs: ordinary output is unsupported by the destination") // ErrRecoverableOutputUnsupported reports that the native filesystem cannot // establish restart identity and checkpoint ordering. ErrRecoverableOutputUnsupported = errors.New("osfs: recoverable native output is unsupported") // ErrUnsafeNamespace reports that the output namespace cannot safely retain // resumable state or receive file content. ErrUnsafeNamespace = errors.New("osfs: recoverable output namespace is unsafe") // ErrNamespaceCollision reports that a no-replace namespace mutation found an // existing entry. ErrNamespaceCollision = errors.New("osfs: output namespace entry already exists") // ErrNameRejected is a pre-mutation refusal of one confined component, not // a permission, ownership, or storage failure. ErrNameRejected = errors.New("osfs: destination rejects the output name") // ErrNamespaceLockBusy reports that another operation owns the namespace lock. ErrNamespaceLockBusy = errors.New("osfs: output namespace lock is already held") )
var ( ErrInvalidRootBinding = errors.New("osfs: output root binding is invalid") ErrInvalidDestinationBindingID = errors.New("osfs: destination binding identity is invalid") )
var ErrFixedLinkSourceChanged = errors.New("osfs: fixed output link source changed")
ErrFixedLinkSourceChanged is emitted only before attempting a no-replace mutation. That cut lets recovery distinguish an invalidated source witness from an unknown final-publication outcome.
Functions ¶
This section is empty.
Types ¶
type CapabilityEvidence ¶
type CapabilityEvidence struct {
// contains filtered or unexported fields
}
CapabilityEvidence pairs a guarantee with the closed reason that explains a negative result. Supported facts intentionally carry no reason.
func SupportedCapability ¶
func SupportedCapability() CapabilityEvidence
func UnsupportedCapability ¶
func UnsupportedCapability(reason CapabilityReason) (CapabilityEvidence, error)
func (CapabilityEvidence) Fact ¶
func (evidence CapabilityEvidence) Fact() CapabilityFact
func (CapabilityEvidence) Reason ¶
func (evidence CapabilityEvidence) Reason() CapabilityReason
func (CapabilityEvidence) Supported ¶
func (evidence CapabilityEvidence) Supported() bool
func (CapabilityEvidence) Valid ¶
func (evidence CapabilityEvidence) Valid() bool
type CapabilityFact ¶
type CapabilityFact uint8
CapabilityFact is deliberately binary. Platforms report one fact per semantic guarantee rather than smuggling partial support through an enum.
const ( CapabilityUnsupported CapabilityFact = iota + 1 CapabilitySupported )
func (CapabilityFact) String ¶
func (fact CapabilityFact) String() string
func (CapabilityFact) Supported ¶
func (fact CapabilityFact) Supported() bool
func (CapabilityFact) Valid ¶
func (fact CapabilityFact) Valid() bool
type CapabilityReason ¶
type CapabilityReason uint8
CapabilityReason is closed because callers may expose it in typed diagnostics and must never infer behavior from platform error strings.
const ( CapabilityReasonNone CapabilityReason = iota + 1 CapabilityReasonUnsupportedFilesystem CapabilityReasonNetworkFilesystem CapabilityReasonUserspaceFilesystem CapabilityReasonCloudPlaceholder CapabilityReasonReparseOrNestedMount CapabilityReasonUnsafePublication CapabilityReasonUnverifiableOperationRecovery CapabilityReasonUnverifiableRangeRecovery CapabilityReasonUnverifiableCrashCleanup CapabilityReasonCleanupOwnershipUnknown )
func (CapabilityReason) String ¶
func (reason CapabilityReason) String() string
func (CapabilityReason) Valid ¶
func (reason CapabilityReason) Valid() bool
type CreateAuthorityValidator ¶
type CreateAuthorityValidator interface {
ValidateCreateAuthority() error
}
CreateAuthorityValidator verifies that a live directory capability still carries the authority required to create a child.
type CurrentEntryReference ¶
CurrentEntryReference is a live-handle identity witness for one opened entry. It is suitable for same-object checks only while retained and is never a restart-stable locator.
type DestinationBindingID ¶
type DestinationBindingID [DestinationBindingIDBytes]byte
DestinationBindingID identifies a retained destination binding. Recoverable bindings derive it from a durable namespace witness; process bindings derive it from a fresh nonce and cannot use it to reopen a previous operation.
func DestinationBindingIDFromBytes ¶
func DestinationBindingIDFromBytes(raw []byte) (DestinationBindingID, error)
func NewDestinationBindingID ¶
func NewDestinationBindingID( rootIdentity []byte, namespaceIdentity []byte, ) (DestinationBindingID, error)
func NewProcessDestinationBindingID ¶
func NewProcessDestinationBindingID(nonce []byte) (DestinationBindingID, error)
NewProcessDestinationBindingID allocates an identity that cannot be recreated from a path or stale private files. The retained root handle remains authority.
func (DestinationBindingID) AuthorityRef ¶
func (id DestinationBindingID) AuthorityRef() (receivecontract.AuthorityRef, error)
func (DestinationBindingID) Bytes ¶
func (id DestinationBindingID) Bytes() []byte
func (DestinationBindingID) IsZero ¶
func (id DestinationBindingID) IsZero() bool
func (DestinationBindingID) String ¶
func (id DestinationBindingID) String() string
type DestinationCapabilities ¶
type DestinationCapabilities struct {
// contains filtered or unexported fields
}
DestinationCapabilities keeps independent proofs independent. In particular, failure to prove restart recovery cannot erase a proven no-replace publish.
func NewDestinationCapabilities ¶
func NewDestinationCapabilities( safePublish CapabilityEvidence, operationRecovery CapabilityEvidence, rangeRecovery CapabilityEvidence, crashCleanup CapabilityEvidence, ) (DestinationCapabilities, error)
func (DestinationCapabilities) CrashCleanup ¶
func (capabilities DestinationCapabilities) CrashCleanup() CapabilityEvidence
func (DestinationCapabilities) OperationRecovery ¶
func (capabilities DestinationCapabilities) OperationRecovery() CapabilityEvidence
func (DestinationCapabilities) RangeRecovery ¶
func (capabilities DestinationCapabilities) RangeRecovery() CapabilityEvidence
func (DestinationCapabilities) SafePublish ¶
func (capabilities DestinationCapabilities) SafePublish() CapabilityEvidence
func (DestinationCapabilities) Valid ¶
func (capabilities DestinationCapabilities) Valid() bool
type Directory ¶
type Directory interface {
Close() error
Duplicate() (Directory, error)
Sync() error
// Names requires a complete enumeration within the limit. ReadNameBatch
// permits a larger namespace while bounding the returned work.
Names(limit int) ([]string, error)
ReadNameBatch(limit int) (DirectoryNameBatch, error)
ObserveEntry(name string) (EntryKind, error)
ClassifyExactEntry(name string) (EntryKind, bool, error)
OpenEntry(name string) (CurrentEntryReference, error)
EntryMatches(name string, expected CurrentEntryReference) (bool, error)
OpenPinnedDirectory(expected CurrentEntryReference, private bool) (Directory, error)
RemoveEntry(name string, expected CurrentEntryReference) error
SameDirectory(Directory) (bool, error)
SetModifiedTime(catalog.ModifiedTime) error
OpenDirectory(name string, private bool) (Directory, error)
CreateDirectory(name string, private bool) (Directory, error)
InstallDirectoryNoReplace(candidate Directory, name string) (Directory, error)
RemoveDirectory(name string, expected Directory) error
// CreateFile exclusively creates and initializes an exact-sized file.
// Providers own rollback until success. If rollback cannot be completed,
// a nil file does not prove that the name is absent; callers must not infer
// cleanup authority by reopening it or dismantle dependent recovery state.
CreateFile(name string, private bool, size int64) (MutableFile, error)
OpenObservedFile(name string, private bool) (ObservedFile, error)
OpenRecoveryDurabilityFile(name string, private bool) (RecoveryDurabilityFile, error)
OpenMutableFile(name string, private bool) (MutableFile, error)
LinkFileNoReplace(source FileIdentity, name string) (ObservedFile, error)
ReplacePrivateFile(source FileIdentity, name string) error
RemoveFile(name string, expected FileIdentity) error
AcquireLock(name string, existingOnly bool) (Lock, bool, error)
}
Directory is a live, fixed-handle directory capability. Restart-stable ownership is bound at platform identityScheme boundaries rather than exposed as a second, path-like authority on each directory handle.
type DirectoryNameBatch ¶
DirectoryNameBatch starts at the beginning of a fresh handle-relative scan. Removing returned entries advances subsequent batches without persisting a filesystem cursor. Names are locators; each mutation still requires ownership.
type EntryKind ¶
type EntryKind uint8
EntryKind separates safe presence from object authority. Callers use it to settle a pre-state final-path collision without opening or following a directory, reparse point, or other non-regular object.
const ( // EntryAbsent means the named directory entry does not exist. EntryAbsent EntryKind = iota // EntryRegularFile means the named entry is a regular file. EntryRegularFile // EntryDirectory means the named entry is a directory. EntryDirectory // EntryOther means the named entry exists but is neither a regular file nor a directory. EntryOther )
type ExecutionMode ¶
type ExecutionMode uint8
const ( ExecutionResumable ExecutionMode = iota + 1 ExecutionLiveOnly )
func SelectExecutionMode ¶
func SelectExecutionMode(capabilities DestinationCapabilities) (ExecutionMode, error)
SelectExecutionMode keeps safe current-process publication independent from restart authority. Missing restart evidence selects a lifecycle that retains live handles and never treats abandoned private names as recovery authority.
func (ExecutionMode) String ¶
func (mode ExecutionMode) String() string
func (ExecutionMode) Valid ¶
func (mode ExecutionMode) Valid() bool
type FileIdentity ¶
type FileIdentity interface {
Close() error
Size() (uint64, error)
SameFile(FileIdentity) (bool, error)
}
FileIdentity is the common authority required to prove that two concurrently open handles still name the same regular file. It intentionally carries no content, durability, or metadata-mutation operation.
type IdentitySchemeID ¶
type IdentitySchemeID = checkpointmodel.IdentitySchemeID
func NewIdentitySchemeID ¶
func NewIdentitySchemeID(value string) (IdentitySchemeID, error)
type Lock ¶
type Lock interface {
File() MutableFile
Close() error
}
Lock retains both the namespace lock and the fixed file capability that carries its data.
type MetadataAuthorityValidator ¶
type MetadataAuthorityValidator interface {
ValidateMetadataAuthority() error
}
MetadataAuthorityValidator verifies that a live directory capability still carries the authority required to change metadata.
type MutableFile ¶
type MutableFile interface {
ObservedFile
io.WriterAt
Sync() error
SetModifiedTime(catalog.ModifiedTime) error
}
MutableFile is the active transfer authority. Observation is included because transfer settlement must verify the metadata installed by this same handle.
type NativeErrorCarrier ¶
type NativeErrorCarrier interface {
NativeErrorClass() NativeErrorClass
}
type NativeErrorClass ¶
type NativeErrorClass uint8
NativeErrorClass is a bounded provider diagnosis. Raw operating-system errors remain available to the provider, while higher layers can freeze this class before redacting diagnostic detail.
const ( NativeErrorAccessDenied NativeErrorClass = iota + 1 NativeErrorSharingViolation NativeErrorNotFound NativeErrorInvalidHandle NativeErrorUnsupported NativeErrorIO NativeErrorUnknown )
func ClassifyNativeError ¶
func ClassifyNativeError(err error) (NativeErrorClass, bool)
func (NativeErrorClass) String ¶
func (class NativeErrorClass) String() string
func (NativeErrorClass) Valid ¶
func (class NativeErrorClass) Valid() bool
type ObservedFile ¶
type ObservedFile interface {
FileIdentity
io.ReaderAt
MetadataMatches(uint64, catalog.ModifiedTime) (bool, error)
}
ObservedFile can inspect content and metadata without requesting any native right that can durably change the file.
type OutputRootBinding ¶
type OutputRootBinding struct {
// contains filtered or unexported fields
}
OutputRootBinding commits to both the certified volume and the current root object. Keeping the opaque claims out of durable state prevents a copied native identifier from becoming filesystem authority after restart.
func NewOutputRootBinding ¶
func NewOutputRootBinding( identityScheme IdentitySchemeID, volumeIdentity []byte, objectIdentity []byte, ) (OutputRootBinding, error)
func (OutputRootBinding) Bytes ¶
func (binding OutputRootBinding) Bytes() []byte
func (OutputRootBinding) IdentityScheme ¶
func (binding OutputRootBinding) IdentityScheme() IdentitySchemeID
func (OutputRootBinding) IsZero ¶
func (binding OutputRootBinding) IsZero() bool
func (OutputRootBinding) String ¶
func (binding OutputRootBinding) String() string
type Platform ¶
type Platform interface {
Root() Directory
RootOpenDisposition() RootOpenDisposition
AcquirePublicOperationGuard() (PublicOperationGuard, error)
ValidateModifiedTime(catalog.ModifiedTime) error
// Keys are pure admission indexes, not evidence about an external namespace.
// Directory lookup and no-replace mutation remain authoritative for aliases
// and names introduced by other operations.
CanonicalLocatorKey(string) (string, error)
CanonicalComponentKey(string) (string, error)
Close() error
}
Platform is intentionally smaller than a general filesystem API. Requiring every mutation through fixed directory and file handles makes it difficult for the state machine to accidentally turn a persisted locator into authority.
type PublicEntryNamesValidator ¶
PublicEntryNamesValidator lets a native directory resolve a complete admission set in one scan. Windows needs this deeper batch boundary because DOS aliases are directory metadata; one full enumeration per selected leaf would make a large root and selection amplify each other quadratically.
type PublicOperationGuard ¶
PublicOperationGuard retains native placement authority while one public namespace operation runs. Root is borrowed from the guard and remains valid only until Close; callers must not close it separately.
type PublishNoReplaceOutcome ¶
type PublishNoReplaceOutcome uint8
PublishNoReplaceOutcome describes publication, independently of its error. A zero outcome with an error proves no namespace change succeeded. Once a name may be visible, failures must report Indeterminate and preserve recovery evidence instead of authorizing rollback.
const ( PublishNoReplaceCommitted PublishNoReplaceOutcome = iota + 1 PublishNoReplaceCollision PublishNoReplaceIndeterminate )
func (PublishNoReplaceOutcome) String ¶
func (outcome PublishNoReplaceOutcome) String() string
func (PublishNoReplaceOutcome) Valid ¶
func (outcome PublishNoReplaceOutcome) Valid() bool
type RecoveryDurabilityFile ¶
type RecoveryDurabilityFile interface {
FileIdentity
Sync() error
}
RecoveryDurabilityFile can make an already-authenticated file durable while withholding content read, content write, truncation, and metadata mutation.
type RootOpenDisposition ¶
type RootOpenDisposition = checkpointmodel.RootOpenDisposition
RootOpenDisposition aliases the durable ownership value so platform opens and ownership-marker recovery cannot assign different meanings to the same certified root fact.