Documentation
¶
Overview ¶
Package receive owns one receive operation across connection generations.
Index ¶
- Constants
- Variables
- func Run(ctx context.Context, request Request, deps Dependencies) task.Completion[Result]
- func Settle(input SettlementInput) (task.Completion[Result], error)
- type AdmissionObserved
- type AdmissionTerminalOwner
- type AdmissionTrigger
- type Clock
- type ConnectivityPolicy
- type ContentPath
- type ContentPathObserved
- type Dependencies
- type Failure
- type FailureCode
- type FallbackObserved
- type GenerationChanged
- type LaneAdopted
- type LocalFailure
- type ObservationSource
- type OutputAdmission
- type OutputAuthority
- type OutputCompatibleNameReport
- type OutputConfig
- type OutputFactory
- type OutputFactoryFunc
- type OutputLookup
- type OutputLookupKind
- type OutputMode
- type OutputOperation
- type OutputReservation
- type Pause
- type PeerAttempt
- type PeerDisposition
- type PeerOutcome
- type PeerStarter
- type PeerTerminated
- type ProgressObserved
- type ProgressRetention
- type ReceiverLocalStopReason
- type RecoveryAction
- type RecoveryObserved
- type RecoveryOutcome
- type RecoveryReason
- type RelayConnected
- type RelayContentClaimed
- type Request
- type Result
- type SettlementInput
- type ShareStopSource
- type Ticker
- type Warning
Constants ¶
const ( OutputResumable = output.OutputResumable OutputLiveOnly = output.OutputLiveOnly OutputLookupCreateReady = output.OutputLookupCreateReady OutputLookupNotFound = output.OutputLookupNotFound OutputLookupReopened = output.OutputLookupReopened OutputLookupAlreadyRunning = output.OutputLookupAlreadyRunning OutputLookupNeedsAttention = output.OutputLookupNeedsAttention OutputLookupAmbiguous = output.OutputLookupAmbiguous )
const ( PeerFallbackAllowed = receiverPeerFallbackAllowed PeerSessionUnsafe = receiverPeerSessionUnsafe PeerLocalStop = receiverPeerLocalStop )
Variables ¶
var ErrInvalidConnectivityPolicy = errors.New("invalid connectivity policy")
var (
ErrInvalidReceiverAdmission = errors.New("receiver content admission signal is invalid")
)
var ErrInvalidResult = errors.New("receive result violates its settlement contract")
var ErrMissingOutputFactory = errors.New("receive output factory is required")
var (
ErrRetainedOutputMissing = errors.New("no retained download matches this link and selection")
)
Functions ¶
func Run ¶
func Run(ctx context.Context, request Request, deps Dependencies) task.Completion[Result]
func Settle ¶
func Settle(input SettlementInput) (task.Completion[Result], error)
Types ¶
type AdmissionObserved ¶
type AdmissionObserved struct {
Operation receivecontract.OperationID
Job transfer.TransferJobID
Session protocolsession.ProtocolSessionID
Trigger AdmissionTrigger
TerminalOwner AdmissionTerminalOwner
Cause error
// contains filtered or unexported fields
}
func (AdmissionObserved) DiagnosticRecord ¶
func (v AdmissionObserved) DiagnosticRecord() diagnostics.Record
func (AdmissionObserved) EngineEvent ¶
func (AdmissionObserved) EngineEvent()
type AdmissionTerminalOwner ¶
type AdmissionTerminalOwner = receiverAdmissionTerminalOwner
type AdmissionTrigger ¶
type AdmissionTrigger = receiverAdmissionTrigger
type ConnectivityPolicy ¶
type ConnectivityPolicy uint8
ConnectivityPolicy owns both peer-attempt requirements and application-relay content admission. Keeping those decisions together prevents a mode from accidentally admitting the content path it promises to exclude.
const ( ConnectivityAuto ConnectivityPolicy = iota + 1 ConnectivityRelayOnly ConnectivityP2POnly )
func ParseConnectivityPolicy ¶
func ParseConnectivityPolicy(value string) (ConnectivityPolicy, error)
func (ConnectivityPolicy) String ¶
func (policy ConnectivityPolicy) String() string
type ContentPath ¶
type ContentPath uint8
const ( ContentPathRelay ContentPath = iota + 1 ContentPathDirect ContentPathDirectAndRelay )
type ContentPathObserved ¶
type ContentPathObserved struct {
Path ContentPath
// contains filtered or unexported fields
}
func (ContentPathObserved) EngineEvent ¶
func (ContentPathObserved) EngineEvent()
type Dependencies ¶
type Dependencies struct {
Capacity *liveshare.ReceiveCapacity
Connectivity *nativeconnectivity.Capacity
ICEPool func() icepolicy.ICEEndpointPool
Control task.Control
Clock Clock
ReceiverDial func(context.Context, relayv2.ReceiverConfig) (relayset.ReceiverConnection, error)
Recovery relayset.ReceiverRecoveryOptions
PeerFactory func() (PeerStarter, error)
ResolveEndpoints func(context.Context) ([]string, error)
}
type Failure ¶
type Failure struct {
Fault transferfault.Fault
Interruption transfer.TransferInterruption
Local LocalFailure
Code FailureCode
Cause error
}
Failure retains the authoritative reason selected by application precedence. Clients translate these domain values to vocabulary without re-deciding it.
type FailureCode ¶
type FailureCode uint8
const ( FailureInvalidInput FailureCode = iota + 1 FailureOutputContract FailureOutputOperationAlreadyRunning FailureOutputNeedsAttention FailureOutputOwnership FailureRetainedOutputMissing FailurePeerConfiguration FailurePeerNegotiation FailurePeerProtocol FailurePeerSignaling FailurePeerStopped )
type FallbackObserved ¶
type FallbackObserved struct {
Code FailureCode
// contains filtered or unexported fields
}
func (FallbackObserved) EngineEvent ¶
func (FallbackObserved) EngineEvent()
type GenerationChanged ¶
type GenerationChanged struct {
Operation receivecontract.OperationID
Job transfer.TransferJobID
Previous, Current protocolsession.ProtocolSessionID
// contains filtered or unexported fields
}
func (GenerationChanged) DiagnosticRecord ¶
func (v GenerationChanged) DiagnosticRecord() diagnostics.Record
func (GenerationChanged) EngineEvent ¶
func (GenerationChanged) EngineEvent()
type LaneAdopted ¶
type LaneAdopted struct {
Session protocolsession.ProtocolSessionID
Lane session.LaneIdentity
// contains filtered or unexported fields
}
func (LaneAdopted) EngineEvent ¶
func (LaneAdopted) EngineEvent()
type LocalFailure ¶
type LocalFailure uint8
const ( LocalFailureNone LocalFailure = iota LocalSelectionMissing LocalRevisionConflict LocalCheckpointInvalid LocalOwnedObjectUnknown LocalDestinationCollision LocalSourceOmitted )
type ObservationSource ¶
type ObservationSource string
const ( ObservationRelay ObservationSource = "relay" ObservationWebRTC ObservationSource = "webrtc" ObservationLane ObservationSource = "lane" ObservationNative ObservationSource = "native" ObservationProtocol ObservationSource = "protocol" ObservationPeerTermination ObservationSource = "peer_termination" ObservationPeerDiagnostic ObservationSource = "peer_diagnostic" )
type OutputAdmission ¶
type OutputAdmission uint8
Request binds one destination authority to a selection. Reconnection never reacquires it: its reservation and authenticated progress belong to the task.
const ( OutputCreateOrResume OutputAdmission = iota OutputResumeExisting OutputRedownload )
type OutputAuthority ¶
type OutputCompatibleNameReport ¶ added in v0.1.5
type OutputCompatibleNameReport = output.CompatibleNameReport
type OutputConfig ¶
type OutputFactory ¶
type OutputFactoryFunc ¶
type OutputFactoryFunc = output.FactoryFunc
type OutputLookup ¶
type OutputLookupKind ¶
type OutputLookupKind = output.LookupKind
type OutputMode ¶
type OutputOperation ¶
type OutputReservation ¶
type OutputReservation = output.Reservation
type Pause ¶
type Pause struct {
Operation receivecontract.OperationID
Recovery RecoveryOutcome
Actions []RecoveryAction
Transfer transfer.JobResult
}
Pause is a settled attempt while the operation still owns its output. The decision port is optional; unattended callers always get an explicit result.
func (Pause) Allows ¶
func (pause Pause) Allows(action RecoveryAction) bool
type PeerAttempt ¶
type PeerAttempt = receiverPeerAttempt
type PeerDisposition ¶
type PeerDisposition = receiverPeerDisposition
type PeerOutcome ¶
type PeerOutcome = receiverPeerMonitorOutcome
func NewPeerOutcome ¶
func NewPeerOutcome(disposition PeerDisposition, cause error) PeerOutcome
type PeerStarter ¶
type PeerStarter = receiverPeerStarter
Aliases expose only the caller-owned injection seams, not lifecycle helpers.
type PeerTerminated ¶
type PeerTerminated struct {
Value v2peer.ReceiverTerminationTrace
LocalStop ReceiverLocalStopReason
// contains filtered or unexported fields
}
func (PeerTerminated) EngineEvent ¶
func (PeerTerminated) EngineEvent()
type ProgressObserved ¶
type ProgressObserved struct {
Operation receivecontract.OperationID
Job transfer.TransferJobID
Value transfer.ReceiveProgressSnapshot
Connectivity downloadmetrics.Snapshot
// contains filtered or unexported fields
}
func (ProgressObserved) EngineEvent ¶
func (ProgressObserved) EngineEvent()
type ProgressRetention ¶
type ProgressRetention uint8
const ( RetentionNone ProgressRetention = iota RetentionCheckpoints RetentionLiveReleased RetentionDiscarded )
type ReceiverLocalStopReason ¶
type ReceiverLocalStopReason uint8
const ( ReceiverLocalStopNone ReceiverLocalStopReason = iota + 1 ReceiverLocalStopCaller ReceiverLocalStopOutputAdmission ReceiverLocalStopRuntimeSessionFailure ReceiverLocalStopNormalCompletion )
func (ReceiverLocalStopReason) DiagnosticName ¶
func (v ReceiverLocalStopReason) DiagnosticName() string
type RecoveryAction ¶
type RecoveryAction uint8
const ( RecoveryExit RecoveryAction = iota + 1 RecoveryRetry RecoveryDiscard )
type RecoveryObserved ¶
type RecoveryObserved struct {
Value relayset.ReceiverRecoveryObservation
// contains filtered or unexported fields
}
func (RecoveryObserved) EngineEvent ¶
func (RecoveryObserved) EngineEvent()
type RecoveryOutcome ¶
type RecoveryOutcome struct {
Retention ProgressRetention
Reason RecoveryReason
}
Retention is independent of the next step: an invalid selection can coexist with completed files and reusable partials that must remain owned and intact.
func (RecoveryOutcome) Retryable ¶ added in v0.1.5
func (outcome RecoveryOutcome) Retryable() bool
Retryable describes replaying the same request after any local remediation. Link viability and the primary fault are independent of output ownership.
func (RecoveryOutcome) ShareStopped ¶ added in v0.1.5
func (outcome RecoveryOutcome) ShareStopped() bool
type RecoveryReason ¶
type RecoveryReason uint8
const ( RecoveryTransferFailure RecoveryReason = iota + 1 RecoveryCollision RecoveryOwnershipUnknown RecoveryRevisionChanged RecoverySelectionMissing RecoverySourceOmitted RecoveryInvalidRequest RecoveryNeedsInspection )
type RelayConnected ¶
type RelayConnected struct {
Endpoint v2.RelayEndpoint
// contains filtered or unexported fields
}
func (RelayConnected) EngineEvent ¶
func (RelayConnected) EngineEvent()
type RelayContentClaimed ¶
type RelayContentClaimed struct {
Operation receivecontract.OperationID
Job transfer.TransferJobID
Session protocolsession.ProtocolSessionID
Trigger AdmissionTrigger
// contains filtered or unexported fields
}
RelayContentClaimed records ownership of an admission attempt, before resume. Completion and useful byte delivery are independent observations.
func (RelayContentClaimed) DiagnosticRecord ¶
func (v RelayContentClaimed) DiagnosticRecord() diagnostics.Record
func (RelayContentClaimed) EngineEvent ¶
func (RelayContentClaimed) EngineEvent()
type Request ¶
type Request struct {
Admission OutputAdmission
OperationID receivecontract.OperationID
Capability link.Link
Only []string
Connectivity ConnectivityPolicy
WaitTimeout time.Duration
Output OutputFactory
Destination string
Diagnostics diagnostics.Sink
OnPause func(context.Context, Pause) (RecoveryAction, error)
}
type Result ¶
type Result struct {
OutputAttention recovery.AttentionReason
Recovery RecoveryOutcome
Transfer transfer.JobResult
Operation receivecontract.OperationID
Job transfer.TransferJobID
Destination string
DestinationAdjusted bool
CompatibleNameReport output.CompatibleNameReport
Elapsed time.Duration
Connectivity downloadmetrics.Snapshot
}
type SettlementInput ¶
type SettlementInput struct {
Result transfer.JobResult
AdmissionError, RuntimeError, ConnectionError, ContextError, CleanupError error
Elapsed time.Duration
Destination string
DestinationAdjusted bool
CompatibleNameReport output.CompatibleNameReport
Operation receivecontract.OperationID
Job transfer.TransferJobID
Connectivity downloadmetrics.Snapshot
}
type ShareStopSource ¶ added in v0.1.5
type ShareStopSource uint8
const ( )
func (ShareStopSource) String ¶ added in v0.1.5
func (source ShareStopSource) String() string
type Warning ¶
type Warning struct {
Code FailureCode
Cause error
// contains filtered or unexported fields
}
func (Warning) EngineEvent ¶
func (Warning) EngineEvent()