Documentation
¶
Overview ¶
Package receiversession owns download-side catalog, revision, block and peer operations.
Index ¶
- Constants
- Variables
- type CatalogScanProgress
- type CatalogScanProgressObserver
- type CatalogScanProgressObserverFunc
- type Factory
- type FactoryConfig
- type InstanceSource
- type InstanceSourceFunc
- type LaneAdmissionDisposition
- type LaneAdmissionResult
- type LaneInstallation
- type PeerControl
- type PeerDiagnostic
- type PeerDiagnosticCode
- type PeerDiagnosticSnapshot
- type PeerOperation
- func (operation *PeerOperation) MaximumContinuations() (int, bool)
- func (operation *PeerOperation) OperationID() protocolsession.OperationID
- func (operation *PeerOperation) OwnsTermination(termination PeerTermination) bool
- func (operation *PeerOperation) Receive(ctx context.Context) PeerReceiveResult
- func (operation *PeerOperation) SendCandidate(ctx context.Context, body []byte) (protocolsession.OperationDisposition, error)
- func (operation *PeerOperation) Terminate(ctx context.Context) PeerTermination
- type PeerReceiveResult
- type PeerSemantics
- type PeerTerminalAuthority
- type PeerTerminalProvenance
- type PeerTerminalSeverity
- type PeerTermination
- func (termination PeerTermination) Authority() PeerTerminalAuthority
- func (termination PeerTermination) ConsequenceProvenance() PeerTerminalProvenance
- func (termination PeerTermination) Diagnostics() PeerDiagnosticSnapshot
- func (termination PeerTermination) Severity() PeerTerminalSeverity
- func (termination PeerTermination) TransitionProvenance() PeerTerminalProvenance
- type RecordDecoder
- type RemoteOperationError
- type RemoteOperationFailureSnapshot
- func (failure RemoteOperationFailureSnapshot) Code() uint16
- func (failure RemoteOperationFailureSnapshot) Message() string
- func (failure RemoteOperationFailureSnapshot) RetryAfter() time.Duration
- func (failure RemoteOperationFailureSnapshot) Retryable() bool
- func (failure RemoteOperationFailureSnapshot) Scope() uint8
- type RemoteRevisionError
- type Runtime
- func (runtime *Runtime) AttachLane(ctx context.Context, grant protocolsession.LaneGrant, ...) (LaneAdmissionResult, error)
- func (runtime *Runtime) AttachedLanes() int
- func (runtime *Runtime) AwaitPathRetirement(ctx context.Context) bool
- func (runtime *Runtime) BeginClose()
- func (runtime *Runtime) BindDownloadMetrics(metrics *downloadmetrics.Metrics)
- func (runtime *Runtime) BlockBroker() *transfer.BlockBroker
- func (runtime *Runtime) Catalog() *catalogflow.Client
- func (runtime *Runtime) CleanupError() error
- func (runtime *Runtime) Close()
- func (runtime *Runtime) Descriptor() catalog.ShareDescriptor
- func (runtime *Runtime) DetachLane(identity session.LaneIdentity) bool
- func (runtime *Runtime) Done() <-chan struct{}
- func (runtime *Runtime) Err() error
- func (runtime *Runtime) LaneDone(identity session.LaneIdentity) (<-chan struct{}, bool)
- func (runtime *Runtime) LaneIdentity() (uint32, uint32)
- func (runtime *Runtime) LaneSet() *transferlanes.Set
- func (runtime *Runtime) Lifetime() context.Context
- func (runtime *Runtime) NewTransferJob(intent transfer.ReceiveIntent, jobID transfer.TransferJobID, ...) (*transfer.TransferJob, error)
- func (runtime *Runtime) OpenPeerOperation(ctx context.Context, offer []byte) (*PeerOperation, error)
- func (runtime *Runtime) OpenRevision(ctx context.Context, file catalog.FileID) (revisionaccess.Lease, error)
- func (runtime *Runtime) PathRecoveryFailure(cause error) error
- func (runtime *Runtime) PathsExhausted() bool
- func (runtime *Runtime) ProtocolSessionID() protocolsession.ProtocolSessionID
- func (runtime *Runtime) RecordPrefetchedDirectory(directory catalog.DirectoryID, pages []catalog.CatalogPage)
- func (runtime *Runtime) RejectShareIdentity(cause error)
- func (runtime *Runtime) ReleaseRevision(ctx context.Context, lease content.LeaseID) error
- func (runtime *Runtime) RequestLane(ctx context.Context, requestedLaneID uint32) (protocolsession.LaneGrant, error)
- func (runtime *Runtime) ResolveOrdinaryOutputShape(ctx context.Context, selection transfer.SelectionSpec, ...) (ordinaryoutput.ShapeDecision, error)
- func (runtime *Runtime) RetireLaneIfCovered(identity session.LaneIdentity, successor *session.LaneIdentity) bool
- func (runtime *Runtime) SendPeerPathControl(ctx context.Context, body []byte) error
- func (runtime *Runtime) SendTURNControl(ctx context.Context, body []byte) error
- func (runtime *Runtime) SetPeerPathControlHandler(handler func(context.Context, []byte) error)
- func (runtime *Runtime) SetTURNControlHandler(handler func(context.Context, []byte) error)
- func (runtime *Runtime) Stopping() bool
- func (runtime *Runtime) TransferDependencies() (TransferDependencies, error)
- func (runtime *Runtime) UsableLaneDone(identity session.LaneIdentity) (<-chan struct{}, bool)
- func (runtime *Runtime) WaitClosed()
- type RuntimeResourceLease
- type RuntimeResourceSource
- type TransferDependencies
Constants ¶
const ( // MaxPrefetchedDirectoryBytes bounds the consume-once catalog pages retained // between ordinary output shape resolution and transfer job discovery so // large directories still stream without inflating memory. MaxPrefetchedDirectoryBytes uint64 = 1 << 20 )
Variables ¶
var ErrRemoteLeaseCollision = errors.New("sender reused an active lease identifier")
var ErrScanProgress = errors.New("session runtime scan progress changed identity or regressed")
Functions ¶
This section is empty.
Types ¶
type CatalogScanProgress ¶
type CatalogScanProgress struct {
DirectoryID catalog.DirectoryID
AttemptID catalog.ScanAttemptID
DiscoveredEntries uint64
}
type CatalogScanProgressObserver ¶
type CatalogScanProgressObserver interface {
ObserveCatalogScanProgress(context.Context, CatalogScanProgress) error
}
type CatalogScanProgressObserverFunc ¶
type CatalogScanProgressObserverFunc func(context.Context, CatalogScanProgress) error
func (CatalogScanProgressObserverFunc) ObserveCatalogScanProgress ¶
func (observe CatalogScanProgressObserverFunc) ObserveCatalogScanProgress( ctx context.Context, progress CatalogScanProgress, ) error
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
func NewFactory ¶
func NewFactory(config FactoryConfig) (*Factory, error)
func (*Factory) BeginClose ¶
func (factory *Factory) BeginClose()
BeginClose seals the admission boundary before returning. Existing runtimes remain independent owners of their derived keys and resource leases.
func (*Factory) Connect ¶
func (factory *Factory) Connect(ctx context.Context, channel protocolsession.FrameChannel, route transferlanes.Route) (result *Runtime, resultErr error)
func (*Factory) WaitClosed ¶
func (factory *Factory) WaitClosed()
type FactoryConfig ¶
type FactoryConfig struct {
ContentRoutePolicy transferlanes.ContentRoutePolicy
Descriptor catalog.ShareDescriptor
SessionAuthKey []byte
Sender *senderauth.Verifier
CatalogVerifier catalogflow.ObjectVerifier
RecordDecoder RecordDecoder
ReassemblyProcess *contentflow.ReassemblyAccount
PlaintextProcess *transfer.PlaintextBudget
Random io.Reader
ReceiverInstances InstanceSource
CatalogProgress CatalogScanProgressObserver
PeerControls PeerSemantics
RuntimeResources RuntimeResourceSource
OperationLimits protocolsession.OperationLimits
RouterLimits protocolsession.RouterLimits
Now func() time.Time
After func(time.Duration) <-chan time.Time
ProtocolObservations observationstream.Producer[sessionobs.ProtocolObservation]
LaneSettlementObservationCapacity transferlanes.SettlementObservationCapacity
}
type InstanceSource ¶
type InstanceSource interface {
NewReceiverInstanceID() (protocolsession.ReceiverInstanceID, error)
}
type InstanceSourceFunc ¶
type InstanceSourceFunc func() (protocolsession.ReceiverInstanceID, error)
func (InstanceSourceFunc) NewReceiverInstanceID ¶
func (function InstanceSourceFunc) NewReceiverInstanceID() (protocolsession.ReceiverInstanceID, error)
type LaneAdmissionDisposition ¶
type LaneAdmissionDisposition uint8
const ( LaneAdmissionUnverified LaneAdmissionDisposition = iota + 1 LaneAdmissionAccepted LaneAdmissionRejected )
type LaneAdmissionResult ¶
type LaneAdmissionResult struct {
GrantOperationID protocolsession.OperationID
Lane session.LaneIdentity
Disposition LaneAdmissionDisposition
Rejection protocolsession.LaneRejection
LaneInstallation LaneInstallation
}
LaneAdmissionResult separates authenticated sender settlement from local publication. A verified response remains authoritative even when the exact candidate owner cannot subsequently enter both receiver lane registries.
type LaneInstallation ¶
type LaneInstallation uint8
const ( LaneInstallationNotAttempted LaneInstallation = iota + 1 LaneInstalled LaneInstallationFailed )
type PeerControl ¶
type PeerControl struct {
// contains filtered or unexported fields
}
PeerControl is an authenticated sender signaling value. The runtime exposes semantic bytes only after the lane-bound signature and the injected peer schema validator have both succeeded.
func (PeerControl) Body ¶
func (control PeerControl) Body() []byte
func (PeerControl) Kind ¶
func (control PeerControl) Kind() protocolsession.MessageKind
type PeerDiagnostic ¶
type PeerDiagnostic struct {
// contains filtered or unexported fields
}
func (PeerDiagnostic) Code ¶
func (diagnostic PeerDiagnostic) Code() PeerDiagnosticCode
func (PeerDiagnostic) RemoteFailure ¶
func (diagnostic PeerDiagnostic) RemoteFailure() ( RemoteOperationFailureSnapshot, bool, )
type PeerDiagnosticCode ¶
type PeerDiagnosticCode uint16
const ( PeerDiagnosticOpaqueFailure PeerDiagnosticCode = iota + 1 PeerDiagnosticContextCanceled PeerDiagnosticOperationMissing PeerDiagnosticRuntimeClosed PeerDiagnosticOperationOverflow PeerDiagnosticUnknownControl PeerDiagnosticControlMalformed PeerDiagnosticRemoteOperationRejected PeerDiagnosticOperationRetry PeerDiagnosticRemoteFailureMalformed PeerDiagnosticRemoteFailureScopeViolation PeerDiagnosticRemoteAnswerConflict PeerDiagnosticRemoteFinalConflict PeerDiagnosticRemoteContinuationViolation PeerDiagnosticCleanupFailed PeerDiagnosticTruncated )
type PeerDiagnosticSnapshot ¶
type PeerDiagnosticSnapshot struct {
// contains filtered or unexported fields
}
func (PeerDiagnosticSnapshot) Components ¶
func (snapshot PeerDiagnosticSnapshot) Components() []PeerDiagnostic
func (PeerDiagnosticSnapshot) Truncated ¶
func (snapshot PeerDiagnosticSnapshot) Truncated() bool
type PeerOperation ¶
type PeerOperation struct {
// contains filtered or unexported fields
}
PeerOperation owns one long-lived PEER_OFFER operation. Answer and candidates are fragments; a remote final, explicit Terminate, or runtime shutdown ends the exact operation object.
func (*PeerOperation) MaximumContinuations ¶
func (operation *PeerOperation) MaximumContinuations() (int, bool)
func (*PeerOperation) OperationID ¶
func (operation *PeerOperation) OperationID() protocolsession.OperationID
func (*PeerOperation) OwnsTermination ¶
func (operation *PeerOperation) OwnsTermination( termination PeerTermination, ) bool
func (*PeerOperation) Receive ¶
func (operation *PeerOperation) Receive(ctx context.Context) PeerReceiveResult
func (*PeerOperation) SendCandidate ¶
func (operation *PeerOperation) SendCandidate( ctx context.Context, body []byte, ) (protocolsession.OperationDisposition, error)
func (*PeerOperation) Terminate ¶
func (operation *PeerOperation) Terminate(ctx context.Context) PeerTermination
Terminate atomically claims local ownership when the exact operation is still active. If Receive or runtime shutdown already won, it joins that outcome instead. Every caller observes the same accumulated cause after in-flight Receive and exact-call cleanup complete.
type PeerReceiveResult ¶
type PeerReceiveResult struct {
// contains filtered or unexported fields
}
PeerReceiveResult is an immutable sum: invalid control/terminal combinations cannot be assembled with a public literal or mutable pointer.
func (PeerReceiveResult) Control ¶
func (result PeerReceiveResult) Control() (PeerControl, bool)
func (PeerReceiveResult) Termination ¶
func (result PeerReceiveResult) Termination() (PeerTermination, bool)
type PeerSemantics ¶
type PeerSemantics interface {
protocolsession.SenderControlSemanticValidator
protocolsession.OperationContinuationClassifier
}
type PeerTerminalAuthority ¶
type PeerTerminalAuthority uint8
const ( PeerTerminalAuthorityLocal PeerTerminalAuthority PeerTerminalAuthorityRemote PeerTerminalAuthorityRuntime )
type PeerTerminalProvenance ¶
type PeerTerminalProvenance uint16
const ( PeerProvenanceLocalExplicitStop PeerTerminalProvenance PeerProvenanceLocalContextEnded PeerProvenanceLocalOperationContract PeerProvenanceRemoteOperationRejected PeerProvenanceRemoteOperationRetry PeerProvenanceRemoteUnknownControl PeerProvenanceRemoteControlMalformed PeerProvenanceRemoteFailureMalformed PeerProvenanceRemoteFailureScopeViolation PeerProvenanceRemoteAnswerConflict PeerProvenanceRemoteFinalConflict PeerProvenanceRemoteContinuationViolation PeerProvenanceRuntimeStopping PeerProvenanceRemoteSessionRejected )
type PeerTerminalSeverity ¶
type PeerTerminalSeverity uint8
const ( PeerTerminalOperationOnly PeerTerminalSeverity PeerTerminalSessionUnsafe )
type PeerTermination ¶
type PeerTermination struct {
// contains filtered or unexported fields
}
PeerTermination is a sealed value. Diagnostics cannot manufacture authority, and a termination is valid only for the exact operation token that published it after receive and cleanup joined.
func (PeerTermination) Authority ¶
func (termination PeerTermination) Authority() PeerTerminalAuthority
func (PeerTermination) ConsequenceProvenance ¶
func (termination PeerTermination) ConsequenceProvenance() PeerTerminalProvenance
func (PeerTermination) Diagnostics ¶
func (termination PeerTermination) Diagnostics() PeerDiagnosticSnapshot
func (PeerTermination) Severity ¶
func (termination PeerTermination) Severity() PeerTerminalSeverity
func (PeerTermination) TransitionProvenance ¶
func (termination PeerTermination) TransitionProvenance() PeerTerminalProvenance
type RecordDecoder ¶ added in v0.1.4
type RecordDecoder interface {
DecodeRevision(catalog.FileID, uint32, []byte) (content.FileRevisionDescriptor, error)
DecodeBlock(content.FileRevisionDescriptor, uint64, []byte) (records.BlockRecord, error)
}
type RemoteOperationError ¶
type RemoteOperationError struct {
// contains filtered or unexported fields
}
func NewRemoteOperationError ¶
func NewRemoteOperationError(failure RemoteOperationFailureSnapshot) RemoteOperationError
NewRemoteOperationError materializes an immutable diagnostic value from an already-owned snapshot. It carries no terminal authority; consumers obtain session consequences only from a sealed operation termination.
func (RemoteOperationError) Error ¶
func (RemoteOperationError) Error() string
func (RemoteOperationError) Failure ¶
func (err RemoteOperationError) Failure() RemoteOperationFailureSnapshot
type RemoteOperationFailureSnapshot ¶
type RemoteOperationFailureSnapshot struct {
// contains filtered or unexported fields
}
func (RemoteOperationFailureSnapshot) Code ¶
func (failure RemoteOperationFailureSnapshot) Code() uint16
func (RemoteOperationFailureSnapshot) Message ¶
func (failure RemoteOperationFailureSnapshot) Message() string
func (RemoteOperationFailureSnapshot) RetryAfter ¶
func (failure RemoteOperationFailureSnapshot) RetryAfter() time.Duration
func (RemoteOperationFailureSnapshot) Retryable ¶
func (failure RemoteOperationFailureSnapshot) Retryable() bool
func (RemoteOperationFailureSnapshot) Scope ¶
func (failure RemoteOperationFailureSnapshot) Scope() uint8
type RemoteRevisionError ¶
type RemoteRevisionError struct {
// contains filtered or unexported fields
}
RemoteRevisionError retains the authenticated OPEN_RESULTS diagnostic without letting observers mutate the semantic authority already assigned to the job.
func (*RemoteRevisionError) Error ¶
func (err *RemoteRevisionError) Error() string
func (*RemoteRevisionError) Failure ¶
func (err *RemoteRevisionError) Failure() contentflow.RevisionFailure
func (*RemoteRevisionError) OperationID ¶
func (err *RemoteRevisionError) OperationID() protocolsession.OperationID
func (*RemoteRevisionError) ProtocolSessionID ¶
func (err *RemoteRevisionError) ProtocolSessionID() protocolsession.ProtocolSessionID
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func (*Runtime) AttachLane ¶
func (runtime *Runtime) AttachLane( ctx context.Context, grant protocolsession.LaneGrant, channel protocolsession.FrameChannel, route transferlanes.Route, ) (LaneAdmissionResult, error)
AttachLane consumes one connectivity-owned candidate channel. Core closes that owner on every failure; successful installation transfers it to the runtime lane that will close it on exact detachment or session termination.
func (*Runtime) AttachedLanes ¶
func (*Runtime) AwaitPathRetirement ¶
AwaitPathRetirement joins the physical lane owners before inspecting their winning termination. A request can observe no usable lane while its pump is still retiring; that scheduling race must not discard valid output progress.
func (*Runtime) BeginClose ¶
func (runtime *Runtime) BeginClose()
func (*Runtime) BindDownloadMetrics ¶
func (runtime *Runtime) BindDownloadMetrics(metrics *downloadmetrics.Metrics)
BindDownloadMetrics binds one generation's availability and delivery producers to the same download observation without sharing their synchronization state.
func (*Runtime) BlockBroker ¶
func (runtime *Runtime) BlockBroker() *transfer.BlockBroker
func (*Runtime) Catalog ¶
func (runtime *Runtime) Catalog() *catalogflow.Client
func (*Runtime) CleanupError ¶
CleanupError is final after Done closes. It preserves resource-settlement failures independently of the protocol cause that originally stopped a session.
func (*Runtime) Descriptor ¶
func (runtime *Runtime) Descriptor() catalog.ShareDescriptor
func (*Runtime) DetachLane ¶
func (runtime *Runtime) DetachLane(identity session.LaneIdentity) bool
func (*Runtime) Err ¶
Only lifecycle observations and explicit control-handler installation cross the role boundary. The core's lane registry and operation ownership stay private.
func (*Runtime) LaneDone ¶
func (runtime *Runtime) LaneDone(identity session.LaneIdentity) (<-chan struct{}, bool)
LaneDone identifies exact admitted ownership without consuming transport frames. Connectivity can recover one retired relay while other lanes remain.
func (*Runtime) LaneIdentity ¶
func (*Runtime) LaneSet ¶
func (runtime *Runtime) LaneSet() *transferlanes.Set
func (*Runtime) NewTransferJob ¶
func (runtime *Runtime) NewTransferJob( intent transfer.ReceiveIntent, jobID transfer.TransferJobID, materializer transfer.DirectTreeMaterializer, diag diagnostics.Sink, ) (*transfer.TransferJob, error)
NewTransferJob binds one confirmed receive intent to a single transfer run. The materializer may reopen durable state, but the live protocol session can never derive OperationID from its per-run TransferJobID.
func (*Runtime) OpenPeerOperation ¶
func (*Runtime) OpenRevision ¶
func (*Runtime) PathRecoveryFailure ¶
PathRecoveryFailure preserves the network root after an external replacement budget or handshake fails. Child timeout diagnostics are not caller cancellation.
func (*Runtime) PathsExhausted ¶
PathsExhausted reports the winning lifecycle authority, never an error-text classification. Protocol failures and caller cleanup cannot authorize recovery.
func (*Runtime) ProtocolSessionID ¶
func (runtime *Runtime) ProtocolSessionID() protocolsession.ProtocolSessionID
func (*Runtime) RecordPrefetchedDirectory ¶ added in v0.1.6
func (runtime *Runtime) RecordPrefetchedDirectory( directory catalog.DirectoryID, pages []catalog.CatalogPage, )
RecordPrefetchedDirectory retains a complete, authenticated terminal directory generation for one subsequent OpenDirectoryPages consumer on this live runtime.
func (*Runtime) RejectShareIdentity ¶
RejectShareIdentity ends authority after the application authenticates a contradictory share descriptor. It cannot authorize path recovery, and keeps the protocol cause distinct from the component cancellation used for cleanup.
func (*Runtime) ReleaseRevision ¶
func (*Runtime) RequestLane ¶
func (runtime *Runtime) RequestLane( ctx context.Context, requestedLaneID uint32, ) (protocolsession.LaneGrant, error)
RequestLane obtains the one-use sender-signed grant before connectivity opens or attaches a new physical channel.
func (*Runtime) ResolveOrdinaryOutputShape ¶
func (runtime *Runtime) ResolveOrdinaryOutputShape( ctx context.Context, selection transfer.SelectionSpec, budget ordinaryoutput.ShapeProbeBudget, ) (ordinaryoutput.ShapeDecision, error)
ResolveOrdinaryOutputShape consumes only authenticated catalog metadata from this live session. The returned proof is construction-time state and cannot outlive the canonical ReceiveIntent assembled by its caller.
func (*Runtime) RetireLaneIfCovered ¶ added in v0.1.6
func (runtime *Runtime) RetireLaneIfCovered(identity session.LaneIdentity, successor *session.LaneIdentity) bool
RetireLaneIfCovered atomically checks that the named successor (or any alternative, if nil) can carry control traffic before retiring a usable lane.
func (*Runtime) SendPeerPathControl ¶
func (*Runtime) SendTURNControl ¶
func (*Runtime) SetPeerPathControlHandler ¶
func (*Runtime) SetTURNControlHandler ¶
func (*Runtime) TransferDependencies ¶
func (runtime *Runtime) TransferDependencies() (TransferDependencies, error)
TransferDependencies exposes protocol operations without giving a transfer owner access to the runtime's crypto, grants, or lease registry.
func (*Runtime) UsableLaneDone ¶ added in v0.1.6
func (runtime *Runtime) UsableLaneDone(identity session.LaneIdentity) (<-chan struct{}, bool)
UsableLaneDone lets connectivity publish a newly attached lane only while its exact epoch can carry authenticated traffic.
func (*Runtime) WaitClosed ¶
func (runtime *Runtime) WaitClosed()
type RuntimeResourceLease ¶
type RuntimeResourceLease interface {
Release()
}
type RuntimeResourceSource ¶
type RuntimeResourceSource interface {
AcquireReceiverRuntimeResources() (RuntimeResourceLease, error)
}
type TransferDependencies ¶
type TransferDependencies = receiverTransferDependencies