checkpointmodel

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: 15 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 checkpointmodel owns the transport-neutral durable checkpoint values and their pure reducers. Filesystem repositories and runtime adapters may project these values, but they cannot reinterpret persisted bytes.

Index

Constants

View Source
const (
	LiveCleanupNamespaceV1     = "cleanup-v1"
	LiveCleanupTicketVersionV1 = uint8(1)
	LiveCleanupTicketDomainV1  = "windshare/live-cleanup-ticket/v1"
	LiveCleanupStageDomainV1   = "windshare/live-cleanup-stage/v1"

	LiveCleanupNonceBytesV1         = 16
	MaximumLiveCleanupTicketBytesV1 = 256
)
View Source
const (
	ActiveOperationKeyV1       = uint8(1)
	ActiveOperationKeyDomainV1 = "windshare/active-operation-key/v1"

	OrdinaryOperationRecordVersionV1      = uint8(1)
	OrdinaryOperationRecordDomainV1       = "windshare/ordinary-operation/v1"
	OrdinaryOperationBindingDomainV1      = "windshare/ordinary-operation-binding/v1"
	MaximumOrdinaryOperationRecordBytesV1 = 2 * 1024 * 1024
	MaximumOrdinaryReceiveIntentBytesV1   = 1024 * 1024

	OrdinaryAdmissionCandidateVersionV1 = uint8(1)
	OrdinaryAdmissionCandidateDomainV1  = "windshare/ordinary-admission-candidate/v1"
)
View Source
const (
	OwnershipMarker = "windshare/file-checkpoint/v2"
	NamespaceName   = ".windshare-output/checkpoints-v2"

	CallerProvidedContainer RootOpenDisposition = "caller-provided-container"
	AuthorityCreatedRoot    RootOpenDisposition = "authority-created-root"

	IdentitySchemeLinuxHandleV2     IdentitySchemeID = "linux/ext4/handle/v2"
	IdentitySchemeWindowsObjectIDV1 IdentitySchemeID = "windows/ntfs/object-id/v1"
	IdentitySchemeDarwinObjectIDV1  IdentitySchemeID = "darwin/apfs/object-id/v1"
	IdentitySchemePortableWitnessV1 IdentitySchemeID = "portable/witness/v1"
)
View Source
const (
	SchemaVersion uint8 = 4

	MaxCheckpointRecordsPerOperation          = 1_048_576
	MaxCheckpointAuxiliaryEntriesPerOperation = MaxCheckpointRecordsPerOperation
	CheckpointShardBuckets                    = 256
)
View Source
const (
	ReservationClaimRecordVersionV2       = uint8(2)
	ReservationClaimRecordDomainV2        = "windshare/reservation-claim/v2"
	ReservationClaimTokenDomainV2         = "windshare/reservation-claim-token/v2"
	MaximumReservationClaimRecordBytesV2  = 16 * 1024
	MaximumReservationNameBytesV2         = 4 * 1024
	MaximumCanonicalNameKeyBytesV2        = 4 * 1024
	MaximumPersistentIdentityClaimBytesV2 = 4 * 1024
)
View Source
const CheckpointLineageDomain = "windshare/checkpoint-lineage/v1"

Variables

View Source
var (
	ErrInvalidOwnership      = errors.New("checkpoint ownership is invalid")
	ErrOwnershipChecksum     = errors.New("checkpoint ownership checksum is invalid")
	ErrOwnershipNonCanonical = errors.New("checkpoint ownership encoding is not canonical")
)
View Source
var (
	ErrInvalidRecord        = errors.New("file checkpoint v4 is invalid")
	ErrRecordChecksum       = errors.New("file checkpoint v4 checksum is invalid")
	ErrRecordNonCanonical   = errors.New("file checkpoint v4 encoding is not canonical")
	ErrRecordGeneration     = errors.New("file checkpoint v4 generation is invalid")
	ErrRecordBinding        = errors.New("file checkpoint v4 binding is invalid")
	ErrRecordObjectConflict = errors.New("file checkpoint v4 output object has multiple owners")
	ErrRecordRecovery       = errors.New("file checkpoint v4 has no verified committed record")
	ErrRecordCrashBoundary  = errors.New("file checkpoint v4 crash cut is not recoverable")
)
View Source
var ErrInvalidLiveCleanupTicket = errors.New("live cleanup ticket is invalid")
View Source
var ErrInvalidOrdinaryLifecycle = errors.New("ordinary operation lifecycle transition is invalid")
View Source
var ErrInvalidOrdinaryOperation = errors.New("ordinary operation record is invalid")
View Source
var ErrInvalidReservationClaim = errors.New("reservation metadata claim is invalid")

Functions

func CanonicalCheckpointLineageBytes

func CanonicalCheckpointLineageBytes(spec CheckpointLineageSpec) ([]byte, error)

CanonicalCheckpointLineageBytes freezes an eight-byte big-endian frame length for every field. The path field is an outer frame around its segment-count and segment frames, preventing joined-text and segment-boundary ambiguity.

func Committed

func Committed(record Record) bool

func EncodeLiveCleanupTicket

func EncodeLiveCleanupTicket(ticket LiveCleanupTicket) ([]byte, error)

func EncodeOrdinaryAdmissionCandidate

func EncodeOrdinaryAdmissionCandidate(candidate OrdinaryAdmissionCandidate) ([]byte, error)

func EncodeOrdinaryOperationRecord

func EncodeOrdinaryOperationRecord(record OrdinaryOperationRecord) ([]byte, error)

func EncodeOwnership

func EncodeOwnership(ownership Ownership) ([]byte, error)

func EncodeRecord

func EncodeRecord(record Record) ([]byte, error)

func EncodeReservationClaimRecord

func EncodeReservationClaimRecord(record ReservationClaimRecord) ([]byte, error)

func IdentityEqual

func IdentityEqual(left, right Record) bool

func InitialCandidate

func InitialCandidate(record Record) bool

func OrdinaryOperationBindingDigest

func OrdinaryOperationBindingDigest(record OrdinaryOperationRecord) ([sha256.Size]byte, error)

OrdinaryOperationBindingDigest authenticates the immutable operation, destination-reservation, and claim coordinates. Lifecycle and lease changes intentionally do not alter it, so the active index and reverse claim link do not require unsafe multi-file rewrites on every state transition.

func ReduceOrdinaryOperationLifecycle

ReduceOrdinaryOperationLifecycle keeps retained ownership until explicit discard or completion. Item collisions, permission failures, blocked files, and session pauses emit Continue; only authority uncertainty may emit RequireAttention.

func ReservationClaimTokenForCanonicalNameKey

func ReservationClaimTokenForCanonicalNameKey(canonicalNameKey string) ([sha256.Size]byte, error)

func SameCheckpointLineage

func SameCheckpointLineage(left, right Record) bool

SameCheckpointLineage compares all seven logical coordinates. Callers may use the digest as a bounded index, but digest equality alone never grants authority.

func SameCheckpointLineageSpec

func SameCheckpointLineageSpec(left, right CheckpointLineageSpec) bool

func SameOrdinaryOperation

func SameOrdinaryOperation(left, right OrdinaryOperationRecord) bool

func SameReservationClaim

func SameReservationClaim(left, right ReservationClaimRecord) bool

func SupersedesCheckpoint

func SupersedesCheckpoint(installed, candidate Record) bool

SupersedesCheckpoint recognizes progress already covered by an installed record. Unlike a replacement transition, this can span several generations: lazy recovery may advance while an uninstalled image remains in its slot. It grants no authority to install a record or discard a publication receipt.

func ValidLifecycleTransition

func ValidLifecycleTransition(
	previousPhase Phase,
	previousCommit CommitState,
	nextPhase Phase,
	nextCommit CommitState,
) bool

ValidLifecycleTransition is the pure phase reducer used by temporary runtime projections. It does not grant persistence or filesystem authority.

func ValidateLifecycleClaims

func ValidateLifecycleClaims(
	phase Phase,
	quarantineReason QuarantineReason,
	quarantineOrigin QuarantineOrigin,
	retirementReason RetirementReason,
) error

ValidateLifecycleClaims is exported for volatile runtime projections. It owns the V2 byte meanings without granting repository or filesystem authority.

func ValidateTransition

func ValidateTransition(previous, next Record) error

ValidateTransition prevents stale writers from changing immutable identity, regressing generations, or shrinking already verified ranges.

Types

type ActiveOperationKey

type ActiveOperationKey [sha256.Size]byte

func ActiveOperationKeyFromBytes

func ActiveOperationKeyFromBytes(raw []byte) (ActiveOperationKey, error)

func IsolatedOperationKey

func IsolatedOperationKey(operation receivecontract.OperationID) ActiveOperationKey

IsolatedOperationKey gives explicit redownloads their own admission namespace. Automatic matching remains owned by the original selection/destination key.

func NewActiveOperationKey

func NewActiveOperationKey(
	selection transfer.SelectionSpecDigest,
	destinationBindingID receivecontract.AuthorityRef,
	policyVersion uint8,
) (ActiveOperationKey, error)

func NewActiveOperationKeyV1

func NewActiveOperationKeyV1(
	selection transfer.SelectionSpecDigest,
	destinationBindingID receivecontract.AuthorityRef,
) (ActiveOperationKey, error)

func (ActiveOperationKey) Bytes

func (key ActiveOperationKey) Bytes() []byte

func (ActiveOperationKey) IsZero

func (key ActiveOperationKey) IsZero() bool

type Binding

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

Binding is the repository capability for one durable receive operation. All four identities are required because filesystem ownership alone cannot prove that a checkpoint belongs to a particular intent or materialization plan.

func NewBinding

func NewBinding(
	ownership Ownership,
	operation receivecontract.OperationID,
	receiveIntent transfer.ReceiveIntentDigest,
	materialization receivecontract.BindingDigest,
) (Binding, error)

func (Binding) Matches

func (binding Binding) Matches(record Record, expectedID RecordID) bool

func (Binding) MaterializationBindingDigest

func (binding Binding) MaterializationBindingDigest() receivecontract.BindingDigest

func (Binding) OperationID

func (binding Binding) OperationID() receivecontract.OperationID

func (Binding) Ownership

func (binding Binding) Ownership() Ownership

func (Binding) ReceiveIntentDigest

func (binding Binding) ReceiveIntentDigest() transfer.ReceiveIntentDigest

func (Binding) Valid

func (binding Binding) Valid() bool

type CheckpointLineageAssessment added in v0.1.5

type CheckpointLineageAssessment struct {
	Decision   CheckpointLineageDecision
	Comparison content.RevisionComparisonEvidence
}

func ClassifyCheckpointLineage

func ClassifyCheckpointLineage(
	request CheckpointLineageRequest,
	evidence []CheckpointLineageEvidence,
	crossLineageOwnershipConflict bool,
) CheckpointLineageAssessment

ClassifyCheckpointLineage shares the admission rule between lookup and atomic create. Missing evidence can defer reuse only where state and ownership allow it.

func (CheckpointLineageAssessment) RetainsSourceEvidence added in v0.1.5

func (assessment CheckpointLineageAssessment) RetainsSourceEvidence() bool

func (CheckpointLineageAssessment) Valid added in v0.1.5

func (assessment CheckpointLineageAssessment) Valid() bool

type CheckpointLineageDecision

type CheckpointLineageDecision uint8
const (
	CheckpointLineageDecisionAbsent CheckpointLineageDecision = iota + 1
	CheckpointLineageDecisionExact
	CheckpointLineageDecisionRevisionConflict
	CheckpointLineageDecisionOwnershipConflict
	CheckpointLineageDecisionInvalid
	CheckpointLineageDecisionMetadataMatch
	CheckpointLineageDecisionReuseStateBlocked
	CheckpointLineageDecisionRevisionEvidenceUnavailable
)

func (CheckpointLineageDecision) SelectsRecord added in v0.1.5

func (decision CheckpointLineageDecision) SelectsRecord() bool

func (CheckpointLineageDecision) String

func (decision CheckpointLineageDecision) String() string

func (CheckpointLineageDecision) Valid

func (decision CheckpointLineageDecision) Valid() bool

type CheckpointLineageEvidence

type CheckpointLineageEvidence struct {
	FileRevision   content.FileRevision
	ExactSize      uint64
	OwnedObjectID  ObjectID
	SourceMetadata content.SourceMetadata
	Phase          Phase
	CommitState    CommitState
}

type CheckpointLineageID

type CheckpointLineageID [sha256.Size]byte

func DeriveCheckpointLineageID

func DeriveCheckpointLineageID(spec CheckpointLineageSpec) (CheckpointLineageID, error)

func (CheckpointLineageID) Bytes

func (id CheckpointLineageID) Bytes() []byte

func (CheckpointLineageID) IsZero

func (id CheckpointLineageID) IsZero() bool

type CheckpointLineageRequest

type CheckpointLineageRequest = content.RevisionSourceEvidence

type CheckpointLineageSpec

type CheckpointLineageSpec struct {
	OperationID                  receivecontract.OperationID
	ReceiveIntentDigest          transfer.ReceiveIntentDigest
	MaterializationBindingDigest receivecontract.BindingDigest
	FileID                       catalog.FileID
	CanonicalPath                string
	MaterializerKind             MaterializerKind
	AuthorityRef                 receivecontract.AuthorityRef
}

CheckpointLineageSpec deliberately omits physical record and progress fields. A clean revision change must find the occupied logical slot without granting authority over any previous record's object or verified ranges.

type Checksum

type Checksum [sha256.Size]byte

func ChecksumFromBytes

func ChecksumFromBytes(raw []byte) (Checksum, error)

func (Checksum) Bytes

func (id Checksum) Bytes() []byte

func (Checksum) IsZero

func (id Checksum) IsZero() bool

type CommitState

type CommitState uint8
const (
	CommitCandidate CommitState = iota + 1
	CommitVerified
	CommitPublished
	CommitQuarantined
)

func (CommitState) Valid

func (state CommitState) Valid() bool

type IdentitySchemeID

type IdentitySchemeID string

func NewIdentitySchemeID

func NewIdentitySchemeID(value string) (IdentitySchemeID, error)

type LiveCleanupEvent

type LiveCleanupEvent uint8
const (
	LiveCleanupRecordStageCreated LiveCleanupEvent = iota + 1
	LiveCleanupRecordStageRemoved
)

type LiveCleanupNativeProfile

type LiveCleanupNativeProfile uint8

LiveCleanupNativeProfile is intentionally narrower than restart-recovery identityScheme: a live-only ticket proves only cleanup semantics.

const (
	LiveCleanupLinuxExt4V1 LiveCleanupNativeProfile = iota + 1
	LiveCleanupWindowsNTFSV1
)

func (LiveCleanupNativeProfile) String

func (profile LiveCleanupNativeProfile) String() string

func (LiveCleanupNativeProfile) Valid

func (profile LiveCleanupNativeProfile) Valid() bool

type LiveCleanupTicket

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

LiveCleanupTicket is a narrow ownership proof, not a resumable checkpoint. Its type cannot carry selection, intent, revision, ranges, or a public path.

func DecodeLiveCleanupTicket

func DecodeLiveCleanupTicket(encoded []byte) (LiveCleanupTicket, error)

func NewLiveCleanupTicket

func NewLiveCleanupTicket(spec LiveCleanupTicketSpec) (LiveCleanupTicket, error)

func ReduceLiveCleanupTicket

func ReduceLiveCleanupTicket(ticket LiveCleanupTicket, event LiveCleanupEvent) (LiveCleanupTicket, error)

func (LiveCleanupTicket) ExactSize

func (ticket LiveCleanupTicket) ExactSize() uint64

func (LiveCleanupTicket) Generation

func (ticket LiveCleanupTicket) Generation() uint64

func (LiveCleanupTicket) Nonce

func (ticket LiveCleanupTicket) Nonce() []byte

func (LiveCleanupTicket) Profile

func (LiveCleanupTicket) StageName

func (ticket LiveCleanupTicket) StageName() string

func (LiveCleanupTicket) State

func (LiveCleanupTicket) Valid

func (ticket LiveCleanupTicket) Valid() bool

type LiveCleanupTicketSpec

type LiveCleanupTicketSpec struct {
	Nonce      []byte
	ExactSize  uint64
	Profile    LiveCleanupNativeProfile
	Generation uint64
	State      LiveCleanupTicketState
}

type LiveCleanupTicketState

type LiveCleanupTicketState uint8
const (
	LiveCleanupTicketCommitted LiveCleanupTicketState = iota + 1
	LiveCleanupStageCreated
	LiveCleanupStageRemoved
)

func (LiveCleanupTicketState) Valid

func (state LiveCleanupTicketState) Valid() bool

type MaterializerKind

type MaterializerKind uint8
const MaterializerNativeTree MaterializerKind = 1

Native records describe only the filesystem materializer implemented here. Browser storage identities are owned by web/output.

func (MaterializerKind) Valid

func (kind MaterializerKind) Valid() bool

type NextOrdinaryOperationRecordSpec

type NextOrdinaryOperationRecordSpec struct {
	Lifecycle    OrdinaryOperationLifecycle
	Lease        OrdinaryLeaseState
	ClosedReason OrdinaryClosedReason
}

NextOrdinaryOperationRecordSpec retains the immutable operation binding while advancing only registry-owned state. Keeping this constructor in the model prevents persistence code from reconstructing a record from decoded intent bytes and accidentally changing its authority coordinates.

type ObjectID

type ObjectID [sha256.Size]byte

func ObjectIDFromBytes

func ObjectIDFromBytes(raw []byte) (ObjectID, error)

func (ObjectID) Bytes

func (id ObjectID) Bytes() []byte

func (ObjectID) IsZero

func (id ObjectID) IsZero() bool

type OrdinaryAdmissionCandidate

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

func BindOrdinaryAdmissionReservation

func BindOrdinaryAdmissionReservation(
	previous OrdinaryAdmissionCandidate,
	claim ReservationClaimLocator,
) (OrdinaryAdmissionCandidate, error)

BindOrdinaryAdmissionReservation adds the exact cleanup locator while the active-key admission lock is retained. The initial marker still precedes name selection; this transition makes every later public mutation exactly reconcilable without paging the global claim table.

func DecodeOrdinaryAdmissionCandidate

func DecodeOrdinaryAdmissionCandidate(encoded []byte) (OrdinaryAdmissionCandidate, error)

func NewOrdinaryAdmissionCandidate

func NewOrdinaryAdmissionCandidate(
	activeKey ActiveOperationKey,
	operationID receivecontract.OperationID,
) (OrdinaryAdmissionCandidate, error)

func RequireOrdinaryAdmissionAttention

func RequireOrdinaryAdmissionAttention(
	previous OrdinaryAdmissionCandidate,
) (OrdinaryAdmissionCandidate, error)

func (OrdinaryAdmissionCandidate) ActiveOperationKey

func (candidate OrdinaryAdmissionCandidate) ActiveOperationKey() ActiveOperationKey

func (OrdinaryAdmissionCandidate) Generation

func (candidate OrdinaryAdmissionCandidate) Generation() uint64

func (OrdinaryAdmissionCandidate) OperationID

func (candidate OrdinaryAdmissionCandidate) OperationID() receivecontract.OperationID

func (OrdinaryAdmissionCandidate) ReservationClaim

func (candidate OrdinaryAdmissionCandidate) ReservationClaim() ReservationClaimLocator

func (OrdinaryAdmissionCandidate) State

func (OrdinaryAdmissionCandidate) Valid

func (candidate OrdinaryAdmissionCandidate) Valid() bool

type OrdinaryAdmissionCandidateState

type OrdinaryAdmissionCandidateState uint8
const (
	OrdinaryAdmissionPreparing OrdinaryAdmissionCandidateState = iota + 1
	OrdinaryAdmissionNeedsAttention
)

type OrdinaryClosedReason

type OrdinaryClosedReason uint8
const (
	OrdinaryReasonNone OrdinaryClosedReason = iota + 1
	OrdinaryReasonDestinationOwnershipUnknown
	OrdinaryReasonRegistryOwnershipUnknown
	OrdinaryReasonLeaseOwnershipUnknown
	OrdinaryReasonOperationOwnershipUnknown
	OrdinaryReasonCleanupUncertain
)

func (OrdinaryClosedReason) IsAttentionReason

func (reason OrdinaryClosedReason) IsAttentionReason() bool

func (OrdinaryClosedReason) IsCleanupReason

func (reason OrdinaryClosedReason) IsCleanupReason() bool

func (OrdinaryClosedReason) String

func (reason OrdinaryClosedReason) String() string

func (OrdinaryClosedReason) Valid

func (reason OrdinaryClosedReason) Valid() bool

type OrdinaryLeaseState

type OrdinaryLeaseState uint8
const (
	OrdinaryLeaseReleased OrdinaryLeaseState = iota + 1
	OrdinaryLeaseHeld
)

func (OrdinaryLeaseState) Valid

func (state OrdinaryLeaseState) Valid() bool

type OrdinaryLifecycleEvent

type OrdinaryLifecycleEvent uint8
const (
	OrdinaryLifecycleContinue OrdinaryLifecycleEvent = iota + 1
	OrdinaryLifecycleRequireAttention
	OrdinaryLifecycleComplete
	OrdinaryLifecycleDiscard
	OrdinaryLifecycleCleanupFailed
	OrdinaryLifecycleCleanupFinished
	OrdinaryLifecycleStopShare
)

func (OrdinaryLifecycleEvent) Valid

func (event OrdinaryLifecycleEvent) Valid() bool

type OrdinaryOperationLifecycle

type OrdinaryOperationLifecycle uint8
const (
	OrdinaryOperationActive OrdinaryOperationLifecycle = iota + 1
	OrdinaryOperationNeedsAttention
	OrdinaryOperationCompleted
	OrdinaryOperationDiscarded
	OrdinaryOperationCleanupPending
	OrdinaryOperationShareStopped
)

func (OrdinaryOperationLifecycle) ParticipatesInActiveLookup

func (state OrdinaryOperationLifecycle) ParticipatesInActiveLookup() bool

Retained stopped output keeps its selection binding until it is discarded.

func (OrdinaryOperationLifecycle) String

func (state OrdinaryOperationLifecycle) String() string

func (OrdinaryOperationLifecycle) Valid

func (state OrdinaryOperationLifecycle) Valid() bool

type OrdinaryOperationRecord

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

OrdinaryOperationRecord is intentionally operation-sized. Per-file paths, revisions, ranges, phases, and checkpoint references remain solely in FileCheckpointV2 and can therefore never make this active index grow.

func DecodeOrdinaryOperationRecord

func DecodeOrdinaryOperationRecord(encoded []byte) (OrdinaryOperationRecord, error)

func (OrdinaryOperationRecord) ActiveOperationKey

func (record OrdinaryOperationRecord) ActiveOperationKey() ActiveOperationKey

func (OrdinaryOperationRecord) ClosedReason

func (record OrdinaryOperationRecord) ClosedReason() OrdinaryClosedReason

func (OrdinaryOperationRecord) IntentBytes

func (record OrdinaryOperationRecord) IntentBytes() []byte

func (OrdinaryOperationRecord) Lease

func (OrdinaryOperationRecord) Lifecycle

func (OrdinaryOperationRecord) LifecycleGeneration

func (record OrdinaryOperationRecord) LifecycleGeneration() uint64

func (OrdinaryOperationRecord) OperationID

func (OrdinaryOperationRecord) ReceiveIntentDigest

func (record OrdinaryOperationRecord) ReceiveIntentDigest() transfer.ReceiveIntentDigest

func (OrdinaryOperationRecord) ReservationClaim

func (record OrdinaryOperationRecord) ReservationClaim() ReservationClaimLocator

func (OrdinaryOperationRecord) Valid

func (record OrdinaryOperationRecord) Valid() bool

func (OrdinaryOperationRecord) VerifyIntent

type OrdinaryOperationRecordSpec

type OrdinaryOperationRecordSpec struct {
	ActiveKey           ActiveOperationKey
	Intent              transfer.ReceiveIntent
	ReservationClaim    ReservationClaimLocator
	LifecycleGeneration uint64
	Lifecycle           OrdinaryOperationLifecycle
	Lease               OrdinaryLeaseState
	ClosedReason        OrdinaryClosedReason
}

type OrdinaryReceiveIntentDecoder

type OrdinaryReceiveIntentDecoder func([]byte) (transfer.ReceiveIntent, error)

type Ownership

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

Ownership certifies the v2 repository root. Operation, intent, and file identities are deliberately absent so the same root marker cannot authorize cross-operation mutation.

func DecodeOwnership

func DecodeOwnership(encoded []byte) (Ownership, error)

func NewOwnership

func NewOwnership(spec OwnershipSpec) (Ownership, error)

func (Ownership) AuthorityRef

func (ownership Ownership) AuthorityRef() receivecontract.AuthorityRef

func (Ownership) CanonicalBytes

func (ownership Ownership) CanonicalBytes() []byte

func (Ownership) IdentityScheme

func (ownership Ownership) IdentityScheme() IdentitySchemeID

func (Ownership) MaterializerKind

func (ownership Ownership) MaterializerKind() MaterializerKind

func (Ownership) RootOpenDisposition

func (ownership Ownership) RootOpenDisposition() RootOpenDisposition

func (Ownership) Valid

func (ownership Ownership) Valid() bool

type OwnershipSpec

type OwnershipSpec struct {
	Materializer        MaterializerKind
	IdentityScheme      IdentitySchemeID
	AuthorityRef        []byte
	RootOpenDisposition RootOpenDisposition
}

type Phase

type Phase uint8
const (
	PhaseReserved Phase = iota + 1
	PhaseActive
	PhasePaused
	PhasePublishing
	PhasePublished
	PhaseQuarantined
	PhaseRetired
)

func (Phase) Valid

func (phase Phase) Valid() bool

type QuarantineOrigin

type QuarantineOrigin uint8

QuarantineOrigin records the last non-quarantined runtime phase. Its numeric values remain frozen because they are part of the V2 payload.

const (
	QuarantineOriginReserved QuarantineOrigin = iota + 1
	QuarantineOriginWitnessed
	QuarantineOriginPublishing
	QuarantineOriginPublishBlocked
	QuarantineOriginPublished
	QuarantineOriginRetiring
)

func (QuarantineOrigin) Valid

func (origin QuarantineOrigin) Valid() bool

type QuarantineReason

type QuarantineReason uint8
const (
	QuarantineAnchorMissing QuarantineReason = iota + 1
	QuarantineAnchorUnsafe
	QuarantineStageMissing
	QuarantineStageMismatch
	QuarantineStageUnsafe
	QuarantineFinalMismatch
	QuarantineFinalUnsafe
	QuarantinePartialObjectCreation
	QuarantinePublicationHistory
	QuarantineMetadataMismatch
	QuarantineUpdateTemporary
	QuarantineOutputObjectDuplicate
)

func (QuarantineReason) Valid

func (reason QuarantineReason) Valid() bool

type Range

type Range struct {
	Offset uint64
	End    uint64
}

Range is [Offset, End). Persisted ranges must already be sorted, non-overlapping, and non-adjacent so equality is deterministic.

func CanonicalizeRanges

func CanonicalizeRanges(ranges []Range) ([]Range, error)

CanonicalizeRanges is a caller-boundary helper. NewRecord still validates and never repairs persisted input.

func (Range) Length

func (r Range) Length() uint64

type Record

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

Record has private storage so an admitted immutable binding or verified range set cannot be changed behind a repository's authority.

func AdmitMetadataReuse

func AdmitMetadataReuse(previous Record, current content.FileRevisionDescriptor) (Record, error)

AdmitMetadataReuse accepts durable plaintext for a freshly authenticated revision. The caller must separately reopen and authorize the same local object.

func AdvanceDurableRanges

func AdvanceDurableRanges(previous Record, ranges []Range) (Record, error)

AdvanceDurableRanges constructs the next confirmed range image. The caller must sync the owned data before installing it. Atomic record replacement keeps the previous confirmed image authoritative until the successor is installed; an intermediate durable candidate adds no recovery evidence after data sync.

func AdvanceGeneration

func AdvanceGeneration(
	previous Record,
	ranges []Range,
	phase Phase,
	commitState CommitState,
) (Record, error)

func AdvanceState

func AdvanceState(
	previous Record,
	stateGeneration uint64,
	phase Phase,
	commitState CommitState,
	quarantineReason QuarantineReason,
	quarantineOrigin QuarantineOrigin,
	retirementReason RetirementReason,
) (Record, error)

func DecodeRecord

func DecodeRecord(encoded []byte) (Record, error)

func NewRecord

func NewRecord(spec RecordSpec) (Record, error)

func Promote

func Promote(candidate Record, phase Phase, commitState CommitState) (Record, error)

Promote performs candidate-to-committed publication without changing the generation. The repository must still atomically replace the persisted image.

func PromoteInitialCandidate

func PromoteInitialCandidate(record Record) (Record, error)

func Recover

func Recover(committed, candidate *Record) (Record, error)

Recover resolves the supported stable-record/candidate crash cut. Ambiguous, malformed, foreign, and write-ahead candidates never displace the last committed image.

func SelectVerified

func SelectVerified(records ...Record) (Record, error)

SelectVerified ignores write-ahead candidates. Only a committed image can grant have-state after a crash.

func (Record) AuthorityRef

func (record Record) AuthorityRef() receivecontract.AuthorityRef

func (Record) CanonicalBytes

func (record Record) CanonicalBytes() []byte

CanonicalBytes excludes the storage envelope checksum.

func (Record) CanonicalPath

func (record Record) CanonicalPath() string

func (Record) CheckpointGeneration

func (record Record) CheckpointGeneration() uint64

func (Record) CheckpointLineageCanonicalBytes

func (record Record) CheckpointLineageCanonicalBytes() ([]byte, error)

func (Record) CheckpointLineageID

func (record Record) CheckpointLineageID() (CheckpointLineageID, error)

func (Record) CheckpointLineageSpec

func (record Record) CheckpointLineageSpec() (CheckpointLineageSpec, error)

func (Record) Checksum

func (record Record) Checksum() Checksum

func (Record) CommitState

func (record Record) CommitState() CommitState

func (Record) ExactSize

func (record Record) ExactSize() uint64

func (Record) FileID

func (record Record) FileID() catalog.FileID

func (Record) FileRevision

func (record Record) FileRevision() content.FileRevision

func (Record) MaterializationBindingDigest

func (record Record) MaterializationBindingDigest() receivecontract.BindingDigest

func (Record) MaterializerKind

func (record Record) MaterializerKind() MaterializerKind

func (Record) Namespace

func (record Record) Namespace() string

func (Record) OperationID

func (record Record) OperationID() receivecontract.OperationID

func (Record) OwnedObjectID

func (record Record) OwnedObjectID() ObjectID

func (Record) OwnershipMarker

func (record Record) OwnershipMarker() string

func (Record) Phase

func (record Record) Phase() Phase

func (Record) QuarantineOrigin

func (record Record) QuarantineOrigin() QuarantineOrigin

func (Record) QuarantineReason

func (record Record) QuarantineReason() QuarantineReason

func (Record) ReceiveIntentDigest

func (record Record) ReceiveIntentDigest() transfer.ReceiveIntentDigest

func (Record) RecordID

func (record Record) RecordID() RecordID

func (Record) RetirementReason

func (record Record) RetirementReason() RetirementReason

func (Record) ReusedFrom

func (record Record) ReusedFrom() content.FileRevision

func (Record) SchemaVersion

func (record Record) SchemaVersion() uint8

func (Record) SourceEvidence added in v0.1.5

func (record Record) SourceEvidence() content.RevisionSourceEvidence

func (Record) SourceMetadata

func (record Record) SourceMetadata() content.SourceMetadata

func (Record) StateGeneration

func (record Record) StateGeneration() uint64

func (Record) Valid

func (record Record) Valid() bool

func (Record) VerifiedRanges

func (record Record) VerifiedRanges() []Range

type RecordID

type RecordID [sha256.Size]byte

func RecordIDFromBytes

func RecordIDFromBytes(raw []byte) (RecordID, error)

func (RecordID) Bytes

func (id RecordID) Bytes() []byte

func (RecordID) IsZero

func (id RecordID) IsZero() bool

type RecordSpec

type RecordSpec struct {
	OwnershipMarker              string
	Namespace                    string
	OperationID                  receivecontract.OperationID
	ReceiveIntentDigest          transfer.ReceiveIntentDigest
	MaterializationBindingDigest receivecontract.BindingDigest
	FileID                       catalog.FileID
	FileRevision                 content.FileRevision
	SourceMetadata               content.SourceMetadata
	ReusedFrom                   content.FileRevision
	CanonicalPath                string
	ExactSize                    uint64
	MaterializerKind             MaterializerKind
	AuthorityRef                 []byte
	OwnedObjectID                []byte
	StateGeneration              uint64
	CheckpointGeneration         uint64
	VerifiedRanges               []Range
	Phase                        Phase
	CommitState                  CommitState
	QuarantineReason             QuarantineReason
	QuarantineOrigin             QuarantineOrigin
	RetirementReason             RetirementReason
}

type ReservationClaimLocator

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

ReservationClaimLocator is the exact private-record coordinate needed to recover a frozen destination reservation. The generation names the operation-bound claim, not the earlier authority handle generation.

func NewReservationClaimLocator

func NewReservationClaimLocator(token [sha256.Size]byte, generation uint64) (ReservationClaimLocator, error)

func (ReservationClaimLocator) Generation

func (locator ReservationClaimLocator) Generation() uint64

func (ReservationClaimLocator) Token

func (locator ReservationClaimLocator) Token() [sha256.Size]byte

func (ReservationClaimLocator) Valid

func (locator ReservationClaimLocator) Valid() bool

type ReservationClaimPhase

type ReservationClaimPhase uint8
const (
	ReservationClaimed ReservationClaimPhase = iota + 1
	ReservationBindingBound
	ReservationDirectoryBound
	ReservationOperationBound
)

func (ReservationClaimPhase) Valid

func (phase ReservationClaimPhase) Valid() bool

type ReservationClaimRecord

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

ReservationClaimRecord is root-private name ownership, not public path authority. The canonical key is used only to serialize claims that the native filesystem considers equal; mutations still require retained destination handles.

func BindReservationDirectory

func BindReservationDirectory(
	previous ReservationClaimRecord,
	persistentIdentity []byte,
) (ReservationClaimRecord, error)

func BindReservationOperation

func BindReservationOperation(
	previous ReservationClaimRecord,
	recordDigest [sha256.Size]byte,
) (ReservationClaimRecord, error)

func DecodeReservationClaimRecord

func DecodeReservationClaimRecord(encoded []byte) (ReservationClaimRecord, error)

func ReservationClaimRecordFromCanonicalBytes

func ReservationClaimRecordFromCanonicalBytes(
	encoded []byte,
	token [sha256.Size]byte,
	generation uint64,
) (ReservationClaimRecord, error)

func (ReservationClaimRecord) CanonicalNameKey

func (record ReservationClaimRecord) CanonicalNameKey() string

func (ReservationClaimRecord) CollisionIndex

func (record ReservationClaimRecord) CollisionIndex() uint32

func (ReservationClaimRecord) EntryKind

func (ReservationClaimRecord) Generation

func (record ReservationClaimRecord) Generation() uint64

func (ReservationClaimRecord) LogicalReservedName

func (record ReservationClaimRecord) LogicalReservedName() string

func (ReservationClaimRecord) OperationBindingDigest

func (record ReservationClaimRecord) OperationBindingDigest() [sha256.Size]byte

func (ReservationClaimRecord) OperationID

func (record ReservationClaimRecord) OperationID() receivecontract.OperationID

func (ReservationClaimRecord) PersistentIdentity

func (record ReservationClaimRecord) PersistentIdentity() []byte

func (ReservationClaimRecord) Phase

func (ReservationClaimRecord) PhysicalName

func (record ReservationClaimRecord) PhysicalName() string

func (ReservationClaimRecord) RequestedName

func (record ReservationClaimRecord) RequestedName() string

func (ReservationClaimRecord) ReservationDigest

func (record ReservationClaimRecord) ReservationDigest() receivecontract.BindingDigest

func (ReservationClaimRecord) ReservationID

func (ReservationClaimRecord) Token

func (record ReservationClaimRecord) Token() [sha256.Size]byte

func (ReservationClaimRecord) Valid

func (record ReservationClaimRecord) Valid() bool

type ReservationClaimRecordSpec

type ReservationClaimRecordSpec struct {
	CanonicalNameKey       string
	OperationID            receivecontract.OperationID
	ReservationID          receivecontract.DestinationReservationID
	RequestedName          string
	LogicalReservedName    string
	PhysicalName           string
	EntryKind              receivecontract.ContainerEntryKind
	CollisionIndex         uint32
	Generation             uint64
	Phase                  ReservationClaimPhase
	ReservationDigest      receivecontract.BindingDigest
	PersistentIdentity     []byte
	OperationBindingDigest [sha256.Size]byte
}

type RetirementReason

type RetirementReason uint8
const (
	RetirementPublished RetirementReason = iota + 1
	RetirementIsolatedFailure
	RetirementPreObjectCollision
	RetirementInvalidatedRevision
)

func (RetirementReason) Valid

func (reason RetirementReason) Valid() bool

type RootOpenDisposition

type RootOpenDisposition string

RootOpenDisposition is a identityScheme fact used by native adapters. It is not destination naming authority and never replaces the opaque AuthorityRef.

func (RootOpenDisposition) Valid

func (disposition RootOpenDisposition) Valid() bool

Jump to

Keyboard shortcuts

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