engine

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: AGPL-3.0 Imports: 50 Imported by: 1 module, 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 engine is WindShare's native application boundary. An Engine owns aggregate resource limits while each task owns its connections, selected source or output, cancellation, and final settlement.

ResolveReceiveLink accepts a URL and optional separate key before task admission. Clients handle ErrReceiveKeyRequired with their own input UI; link validation and key-conflict decisions are shared by native and RPC callers.

StartShare and StartReceive return tasks whose bounded observation streams never control execution. Wait returns the durable final result only after the workflow has stopped producers and released resources. Cancel stops one task; ShareTask.StopShare explicitly stops a share; Close stops all tasks and closes the instance's capacity owner.

TaskResult retains the authoritative Settlement and diagnostic causes. DescribeFailure projects errors into privacy-safe domain Failure codes for UI and CLI presentation. Value contains workflow details; errors.As can recover a structured ReceiveFailure from Err even without a low-level cause. A nil Wait error means the result was retrieved, not that the operation succeeded. StopReason records intent independently of the outcome.

Observations expose direct engine workflow events (which also implement core/diagnostics.Source). Optional request Diagnostics sinks carry source-owned records separately, with engine, task and workflow scope. Hosts drain and close their bounded diagnostic stream after tasks stop; overflow or a closed sink never changes task settlement. Clients own formatting and exit codes; injected ports keep native objects out of the application API.

ShareTask.Ready retains first service readiness: at least one relay registered and local session admission started. Clients own capability presentation and stop the share if presentation fails. Directory prefetch follows readiness in the background; relay availability and active sessions evolve independently.

Output and recovery ports are platform-neutral; hosts assemble osfs through adapters/filesystem. Provider-owned diagnostic events retain native detail.

InspectRecovery returns listed operation identities after releasing destination leases. RecoveryInventory.Discard reacquires output authority and rechecks those identities before changing owned state, so a prompt holds no destination lease.

Index

Constants

View Source
const (
	DefaultCleanupTimeout                                 = 20 * time.Second
	DefaultObservationCapacity observationstream.Capacity = 256
)
View Source
const (
	NetworkUnprovisioned        = networkdirectory.Unprovisioned
	NetworkInvalidConfiguration = networkdirectory.InvalidConfiguration
	NetworkTrustStateUnreadable = networkdirectory.TrustStateUnreadable
	NetworkTrustStateInvalid    = networkdirectory.TrustStateInvalid
	NetworkTrustStateUnwritable = networkdirectory.TrustStateUnwritable
	NetworkDirectoryUnavailable = networkdirectory.SnapshotUnavailable
	NetworkNoRelayCandidates    = networkruntime.NoRelayCandidates
	NetworkAliasUnavailable     = networkruntime.AliasUnavailable
)
View Source
const (
	ReceiveRecoveryExit             = receive.RecoveryExit
	ReceiveRecoveryRetry            = receive.RecoveryRetry
	ReceiveRecoveryDiscard          = receive.RecoveryDiscard
	ReceiveRecoveryTransferFailure  = receive.RecoveryTransferFailure
	ReceiveRecoveryCollision        = receive.RecoveryCollision
	ReceiveRecoveryOwnershipUnknown = receive.RecoveryOwnershipUnknown
	ReceiveRecoveryRevisionChanged  = receive.RecoveryRevisionChanged
	ReceiveRecoverySelectionMissing = receive.RecoverySelectionMissing
	ReceiveRecoverySourceOmitted    = receive.RecoverySourceOmitted
	ReceiveRecoveryInvalidRequest   = receive.RecoveryInvalidRequest
	ReceiveRecoveryNeedsInspection  = receive.RecoveryNeedsInspection
	ReceiveShareStopUnconfirmed     = receive.ShareStopUnconfirmed
	ReceiveShareStopSender          = receive.ShareStopSender
	ReceiveShareStopRelays          = receive.ShareStopRelays
	ReceiveShareStopRecorded        = receive.ShareStopRecorded
	ReceiveRetentionNone            = receive.RetentionNone
	ReceiveRetentionCheckpoints     = receive.RetentionCheckpoints
	ReceiveRetentionDiscarded       = receive.RetentionDiscarded
)
View Source
const (
	ReceiveCreateOrResume = receive.OutputCreateOrResume
	ReceiveResumeExisting = receive.OutputResumeExisting
	ReceiveRedownload     = receive.OutputRedownload
)
View Source
const (
	ConnectivityAuto                 = receive.ConnectivityAuto
	ConnectivityRelayOnly            = receive.ConnectivityRelayOnly
	ConnectivityP2POnly              = receive.ConnectivityP2POnly
	ReceivePeerFallbackAllowed       = receive.PeerFallbackAllowed
	ReceivePeerSessionUnavailable    = receive.PeerSessionUnavailable
	ReceivePeerSessionUnsafe         = receive.PeerSessionUnsafe
	ReceivePeerLocalStop             = receive.PeerLocalStop
	OutputLookupCreateReady          = receive.OutputLookupCreateReady
	OutputLookupNotFound             = receive.OutputLookupNotFound
	OutputLookupReopened             = receive.OutputLookupReopened
	OutputLookupAlreadyRunning       = receive.OutputLookupAlreadyRunning
	OutputLookupNeedsAttention       = receive.OutputLookupNeedsAttention
	OutputLookupAmbiguous            = receive.OutputLookupAmbiguous
	ReceiveLocalFailureNone          = receive.LocalFailureNone
	ReceiveLocalSelectionMissing     = receive.LocalSelectionMissing
	ReceiveLocalRevisionConflict     = receive.LocalRevisionConflict
	ReceiveLocalCheckpointInvalid    = receive.LocalCheckpointInvalid
	ReceiveLocalOwnedObjectUnknown   = receive.LocalOwnedObjectUnknown
	ReceiveLocalDestinationCollision = receive.LocalDestinationCollision
	ReceiveLocalSourceOmitted        = receive.LocalSourceOmitted
)
View Source
const (
	ReceiveFailureInvalidInput                  = receive.FailureInvalidInput
	ReceiveFailureOutputContract                = receive.FailureOutputContract
	ReceiveFailureOutputOperationAlreadyRunning = receive.FailureOutputOperationAlreadyRunning
	ReceiveFailureOutputNeedsAttention          = receive.FailureOutputNeedsAttention
	ReceiveFailureOutputOwnership               = receive.FailureOutputOwnership
	ReceiveFailureRetainedOutputMissing         = receive.FailureRetainedOutputMissing
	ReceiveFailurePeerConfiguration             = receive.FailurePeerConfiguration
	ReceiveFailurePeerNegotiation               = receive.FailurePeerNegotiation
	ReceiveFailurePeerProtocol                  = receive.FailurePeerProtocol
	ReceiveFailurePeerSignaling                 = receive.FailurePeerSignaling
	ReceiveFailurePeerStopped                   = receive.FailurePeerStopped
	ReceiveFailureShareStopped                  = receive.FailureShareStopped

	ReceiveLocalStopNone                  = receive.ReceiverLocalStopNone
	ReceiveLocalStopCaller                = receive.ReceiverLocalStopCaller
	ReceiveLocalStopOutputAdmission       = receive.ReceiverLocalStopOutputAdmission
	ReceiveLocalStopRuntimeSessionFailure = receive.ReceiverLocalStopRuntimeSessionFailure
	ReceiveLocalStopNormalCompletion      = receive.ReceiverLocalStopNormalCompletion

	ReceiveContentPathRelay          = receive.ContentPathRelay
	ReceiveContentPathDirect         = receive.ContentPathDirect
	ReceiveContentPathDirectAndRelay = receive.ContentPathDirectAndRelay

	ReceiveObservationRelay           = receive.ObservationRelay
	ReceiveObservationWebRTC          = receive.ObservationWebRTC
	ReceiveObservationLane            = receive.ObservationLane
	ReceiveObservationNative          = receive.ObservationNative
	ReceiveObservationProtocol        = receive.ObservationProtocol
	ReceiveObservationPeerTermination = receive.ObservationPeerTermination
	ReceiveObservationPeerDiagnostic  = receive.ObservationPeerDiagnostic
)
View Source
const (
	RecoveryInspectStarted   = recovery.InspectStarted
	RecoveryInspectCompleted = recovery.InspectCompleted
	RecoveryDiscardStarted   = recovery.DiscardStarted
	RecoveryDiscardCompleted = recovery.DiscardCompleted

	RecoveryIncomplete                = recovery.OperationIncomplete
	RecoveryResumable                 = recovery.OperationResumable
	RecoveryShareStopped              = recovery.OperationShareStopped
	RecoveryCleanupPending            = recovery.OperationCleanupPending
	RecoveryNeedsAttention            = recovery.OperationNeedsAttention
	RecoveryBlockedPublicationUnknown = recovery.BlockedPublicationUnknown
	RecoveryBlockedCheckpointInvalid  = recovery.BlockedCheckpointInvalid
	RecoveryBlockedOwnedObjectUnknown = recovery.BlockedOwnedObjectUnknown
	RecoveryBlockedRevisionConflict   = recovery.BlockedRevisionConflict
	RecoveryAttentionNone             = recovery.AttentionNone
	RecoveryAttentionDestination      = recovery.AttentionDestination
	RecoveryAttentionRegistry         = recovery.AttentionRegistry
	RecoveryAttentionLease            = recovery.AttentionLease
	RecoveryAttentionOperation        = recovery.AttentionOperation
	RecoveryAttentionCleanup          = recovery.AttentionCleanup
	RecoveryDiscarded                 = recovery.Discarded
	RecoveryDiscardCleanupPending     = recovery.DiscardCleanupPending
	RecoveryDiscardNeedsAttention     = recovery.DiscardNeedsAttention
	RecoveryFailureNeedsAttention     = recovery.FailureNeedsAttention
	RecoveryFailureBusy               = recovery.FailureBusy
	RecoveryFailureChanged            = recovery.FailureChanged
	RecoveryFailureCancelled          = recovery.FailureCancelled
)
View Source
const (
	TaskRunning  = task.Running
	TaskStopping = task.Stopping
	TaskFinished = task.Finished

	NoStop            = task.NoStop
	Cancelled         = task.Cancelled
	ShareStopped      = task.ShareStopped
	ApplicationClosed = task.ApplicationClosed

	OutcomeSuccess   = task.OutcomeSuccess
	OutcomePartial   = task.OutcomePartial
	OutcomePaused    = task.OutcomePaused
	OutcomeCancelled = task.OutcomeCancelled
	OutcomeStopped   = task.OutcomeStopped
	OutcomeFailed    = task.OutcomeFailed

	FailureNone        = task.FailureNone
	FailureLocal       = task.FailureLocal
	FailureNetwork     = task.FailureNetwork
	FailureUsage       = task.FailureUsage
	FailureSourceDrift = task.FailureSourceDrift
)
View Source
const MaxNameAdjustmentSamples = receive.MaxNameAdjustmentSamples

Variables

View Source
var (
	ErrInvalidReceiveLink      = errors.New("invalid receive link")
	ErrReceiveKeyRequired      = errors.New("receive link requires a key")
	ErrReceiveKeyConflict      = errors.New("receive link keys conflict")
	ErrUnsupportedReceiveSuite = errors.New("unsupported receive link suite")
)
View Source
var ErrClosed = errors.New("engine is closed")
View Source
var ErrInvalidConnectivityPolicy = receive.ErrInvalidConnectivityPolicy
View Source
var ErrInvalidReceiveResult = receive.ErrInvalidResult
View Source
var ErrInvalidShareChunkSize = share.ErrInvalidChunkSize
View Source
var ErrInvalidTaskSettlement = task.ErrInvalidSettlement
View Source
var ErrNetworkUnavailable = networkdirectory.ErrUnavailable
View Source
var ErrRecoveryBusy = recovery.ErrBusy
View Source
var ErrRecoveryContract = recovery.ErrContract

Functions

func ResolveReceiveLink(input ReceiveLinkInput) (link.Link, error)

ResolveReceiveLink performs no I/O: clients can ask for a missing key before creating a task or acquiring output authority. Protocol causes remain available through errors.Is for diagnostics.

Types

type Clock added in v0.1.5

type Clock interface {
	Now() time.Time
	// Wait ends when the delay elapses, wake signals a change, or ctx is canceled.
	Wait(ctx context.Context, delay time.Duration, wake <-chan struct{}) error
}

Clock keeps task timestamps, sender registrations, and node admissions in the same time domain.

type Config

type Config struct {
	Network *networkconfig.Config
	// Diagnostics receives engine-scoped infrastructure events (such as
	// directory refreshes and frontend health checks) bound with Scope.EngineID.
	Diagnostics         diagnostics.Sink
	RelaySetup          relaysetup.Dependencies
	Clock               Clock
	SleepInhibitor      SleepInhibitor
	Random              io.Reader
	CleanupTimeout      time.Duration
	ObservationCapacity observationstream.Capacity
	RevisionCapacity    content.HandlePoolConfig
	CatalogLimits       catalog.BudgetLimits
	CacheBytes          uint64
	ReceiveCapacity     liveshare.ReceiveCapacityLimits
	Share               ShareDependencies
	Receive             ReceiveDependencies
}

type ConnectivityPolicy

type ConnectivityPolicy = receive.ConnectivityPolicy

func ParseConnectivityPolicy

func ParseConnectivityPolicy(value string) (ConnectivityPolicy, error)

type ContentPath added in v0.1.6

type ContentPath string
const (
	ContentPathRelay          ContentPath = "relay"
	ContentPathDirect         ContentPath = "direct"
	ContentPathDirectAndRelay ContentPath = "direct_and_relay"
)

type ContentPathSelected added in v0.1.6

type ContentPathSelected struct {
	Path ContentPath
}

func (ContentPathSelected) DiagnosticRecord added in v0.1.6

func (e ContentPathSelected) DiagnosticRecord() diagnostics.Record

func (ContentPathSelected) EngineEvent added in v0.1.6

func (ContentPathSelected) EngineEvent()

type Engine

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

Engine owns aggregate capacity across its native operations, independently of other Engines in the process. Once Close begins, task admission stays closed even if a caller stops waiting for shutdown.

func New

func New(config Config) (*Engine, error)

func (*Engine) Accounts

func (engine *Engine) Accounts() *account.Service

Accounts is shared by all official-node registrations owned by this engine. Existing relay registrations keep their original attribution after login.

func (*Engine) CancelRelaySetup

func (engine *Engine) CancelRelaySetup(ctx context.Context, address string) error

func (*Engine) Close

func (engine *Engine) Close(ctx context.Context) error

func (*Engine) InspectRecovery

func (application *Engine) InspectRecovery(ctx context.Context, authority RecoveryAuthority) (*RecoveryInventory, error)

func (*Engine) NetworkUnavailability

func (engine *Engine) NetworkUnavailability() *NetworkUnavailableError

NetworkUnavailability reports the default network's current blocking reason and permitted retry time. It neither starts maintenance nor judges explicit relays, which remain independent of the built-in network.

func (*Engine) StartReceive

func (engine *Engine) StartReceive(ctx context.Context, request ReceiveRequest) (*ReceiveTask, error)

func (*Engine) StartRelaySetup

func (engine *Engine) StartRelaySetup(ctx context.Context, request RelaySetupRequest) (*Task[RelaySetupResult], error)

func (*Engine) StartShare

func (engine *Engine) StartShare(ctx context.Context, request ShareRequest) (*ShareTask, error)

type Event

type Event = task.Event

type Failure added in v0.1.6

type Failure struct {
	Code               FailureCode
	SourcePath         string
	RelayBaseHint      networkendpoint.RelayBaseHint
	SelectionCollision *SelectionCollision
	Fault              transferfault.Fault
	RetryAfter         time.Duration
}

Failure is the privacy-safe domain failure classification derived from an engine error. It never retains raw provider error text or secret material.

func DescribeFailure

func DescribeFailure(cause error) (Failure, bool)

DescribeFailure classifies an engine or adapter error into a stable, privacy-safe Failure value. Returns (zero, false) only when cause is nil.

func FailureFromFault added in v0.1.6

func FailureFromFault(fault transferfault.Fault) (Failure, bool)

FailureFromFault converts a normalized core transfer fault into an engine Failure.

func (Failure) DiagnosticValue added in v0.1.6

func (f Failure) DiagnosticValue() diagnostics.Value

func (Failure) Valid added in v0.1.6

func (f Failure) Valid() bool

type FailureClass

type FailureClass = task.FailureClass

type FailureCode added in v0.1.6

type FailureCode string

FailureCode is the closed domain error vocabulary exposed by Engine to native hosts and CLI presenters without leaking raw provider error strings.

const (
	FailureUnexpected                    FailureCode = "unexpected"
	FailureCanceled                      FailureCode = "canceled"
	FailureDeadline                      FailureCode = "deadline"
	FailureInvalidInput                  FailureCode = "invalid_input"
	FailureNetworkUnavailable            FailureCode = "network_unavailable"
	FailureCapabilityInvalid             FailureCode = "capability_invalid"
	FailureSelectionMissing              FailureCode = "selection_missing"
	FailureSelectionCollision            FailureCode = "selection_collision"
	FailurePublication                   FailureCode = "capability_publication"
	FailureAccountStorageError           FailureCode = "account_storage_error"
	FailureRelayRejected                 FailureCode = "relay_rejected"
	FailureRelayUnavailable              FailureCode = "relay_unavailable"
	FailureRelayNotFound                 FailureCode = "relay_not_found"
	FailureRelayStopped                  FailureCode = "relay_stopped"
	FailureRelayAccessDenied             FailureCode = "relay_access_denied"
	FailureRelayRouteNotFound            FailureCode = "relay_route_not_found"
	FailureShareStopped                  FailureCode = "share_stopped"
	FailureDirectUnavailable             FailureCode = "direct_unavailable"
	FailureDirectAdmission               FailureCode = "direct_admission"
	FailureDirectPolicy                  FailureCode = "direct_policy"
	FailureDirectBusy                    FailureCode = "direct_busy"
	FailureSourceUnavailable             FailureCode = "source_unavailable"
	FailureSourceChanged                 FailureCode = "source_changed"
	FailureSourceMissing                 FailureCode = "source_missing"
	FailureSourceAccessDenied            FailureCode = "source_access_denied"
	FailureSourceUnsupported             FailureCode = "source_unsupported"
	FailureSourceCloudPlaceholder        FailureCode = "source_cloud_placeholder"
	FailureSourceOmitted                 FailureCode = "source_omitted"
	FailureCatalogUnavailable            FailureCode = "catalog_unavailable"
	FailureSessionFailed                 FailureCode = "session_failed"
	FailureOutputFailed                  FailureCode = "output_failed"
	FailureOutputBusy                    FailureCode = "output_busy"
	FailureOutputOperationAlreadyRunning FailureCode = "output_operation_already_running"
	FailureOutputNeedsAttention          FailureCode = "output_needs_attention"
	FailureRetainedOutputMissing         FailureCode = "retained_output_missing"
	FailureDestinationCollision          FailureCode = "destination_collision"
	FailureCheckpointFailed              FailureCode = "checkpoint_failed"
	FailureCheckpointRevisionConflict    FailureCode = "checkpoint_revision_conflict"
	FailureCheckpointInvalid             FailureCode = "checkpoint_invalid"
	FailureOwnedObjectUnknown            FailureCode = "owned_object_unknown"
)

type Fallback added in v0.1.6

type Fallback struct {
	From    Transport
	To      Transport
	Failure Failure
}

func (Fallback) DiagnosticRecord added in v0.1.6

func (e Fallback) DiagnosticRecord() diagnostics.Record

func (Fallback) EngineEvent added in v0.1.6

func (Fallback) EngineEvent()

type LaneAdopted added in v0.1.6

type LaneAdopted struct {
	Session   protocolsession.ProtocolSessionID
	Lane      session.LaneIdentity
	Transport Transport
}

func (LaneAdopted) DiagnosticRecord added in v0.1.6

func (e LaneAdopted) DiagnosticRecord() diagnostics.Record

func (LaneAdopted) EngineEvent added in v0.1.6

func (LaneAdopted) EngineEvent()

type LifecycleObservation

type LifecycleObservation = task.Lifecycle

LifecycleObservation is retained for management tasks without a transfer workflow.

type NameAdjustment added in v0.1.6

type NameAdjustment = receive.NameAdjustment

type NameAdjustmentSummary added in v0.1.6

type NameAdjustmentSummary = receive.NameAdjustmentSummary

type NetworkBlockingReason

type NetworkBlockingReason = networkdirectory.BlockingReason

type NetworkUnavailableError

type NetworkUnavailableError = networkdirectory.UnavailableError

type Observation

type Observation = task.Observation

type Outcome

type Outcome = task.Outcome

type OutputAuthority

type OutputAuthority = receive.OutputAuthority

type OutputConfig

type OutputConfig = receive.OutputConfig

type OutputFactory

type OutputFactory = receive.OutputFactory

type OutputFactoryFunc

type OutputFactoryFunc = receive.OutputFactoryFunc

type OutputLookup

type OutputLookup = receive.OutputLookup

type OutputLookupKind

type OutputLookupKind = receive.OutputLookupKind

type OutputOperation

type OutputOperation = receive.OutputOperation

type OutputReservation

type OutputReservation = receive.OutputReservation

type PreparedShare

type PreparedShare = share.Prepared

type ReceiveAdmissionObserved

type ReceiveAdmissionObserved = receive.AdmissionObserved

type ReceiveAdmissionTerminalOwner

type ReceiveAdmissionTerminalOwner = receive.AdmissionTerminalOwner

type ReceiveAdmissionTrigger

type ReceiveAdmissionTrigger = receive.AdmissionTrigger

type ReceiveClock

type ReceiveClock = receive.Clock

type ReceiveConnection

type ReceiveConnection interface {
	Descriptor() []byte
	Channel() protocolsession.FrameChannel
	Done() <-chan struct{}
	Err() error
	Close() error
}

ReceiveConnection transfers one authenticated relay connection's ownership to the task.

type ReceiveContentPath

type ReceiveContentPath = receive.ContentPath

type ReceiveDependencies

type ReceiveDependencies struct {
	Clock        ReceiveClock
	ReceiverDial func(context.Context, ReceiveDialRequest) (ReceiveConnection, error)
	Recovery     ReceiveRecoverySettings
	PeerFactory  func() (ReceivePeerStarter, error)
}

type ReceiveDialRequest

type ReceiveDialRequest struct {
	RelayBaseURL string
	ShareID      []byte
	Diagnostics  bool
}

type ReceiveFailure

type ReceiveFailure = receive.Failure

type ReceiveFailureCode

type ReceiveFailureCode = receive.FailureCode

type ReceiveGenerationChanged

type ReceiveGenerationChanged = receive.GenerationChanged

type ReceiveLinkInput

type ReceiveLinkInput struct {
	URL         string
	SeparateKey string
}

ReceiveLinkInput keeps the separate key explicit so it cannot silently override a different key embedded in the URL.

type ReceiveLocalFailure

type ReceiveLocalFailure = receive.LocalFailure

type ReceiveLocalStopReason

type ReceiveLocalStopReason = receive.ReceiverLocalStopReason

type ReceiveOutputAdmission

type ReceiveOutputAdmission = receive.OutputAdmission

type ReceivePause

type ReceivePause = receive.Pause

type ReceivePeerAttempt

type ReceivePeerAttempt = receive.PeerAttempt

type ReceivePeerDisposition

type ReceivePeerDisposition = receive.PeerDisposition

type ReceivePeerOutcome

type ReceivePeerOutcome = receive.PeerOutcome

func NewReceivePeerOutcome

func NewReceivePeerOutcome(disposition ReceivePeerDisposition, cause error) ReceivePeerOutcome

type ReceivePeerStarter

type ReceivePeerStarter = receive.PeerStarter

type ReceiveProgressRetention

type ReceiveProgressRetention = receive.ProgressRetention

type ReceiveRecoveryAction

type ReceiveRecoveryAction = receive.RecoveryAction

type ReceiveRecoveryOutcome

type ReceiveRecoveryOutcome = receive.RecoveryOutcome

type ReceiveRecoveryReason

type ReceiveRecoveryReason = receive.RecoveryReason

type ReceiveRecoverySettings

type ReceiveRecoverySettings struct {
	Clock          RecoveryClock
	TimeoutContext func(context.Context, time.Duration) (context.Context, context.CancelFunc)
	InitialWait    time.Duration
	FastWindow     time.Duration
	WaitTimeout    time.Duration
	Jitter         func(time.Duration) time.Duration
}

type ReceiveRequest

type ReceiveRequest = receive.Request

type ReceiveResult

type ReceiveResult = receive.Result

type ReceiveSettlementInput

type ReceiveSettlementInput = receive.SettlementInput

type ReceiveShareStopSource added in v0.1.5

type ReceiveShareStopSource = receive.ShareStopSource

type ReceiveTask

type ReceiveTask struct{ *Task[ReceiveResult] }

type ReceiveTicker

type ReceiveTicker = receive.Ticker

type RecoveryAttentionReason

type RecoveryAttentionReason = recovery.AttentionReason

type RecoveryAuthority

type RecoveryAuthority = recovery.Authority

type RecoveryBlockedItem

type RecoveryBlockedItem = recovery.BlockedItem

type RecoveryBlockedReason

type RecoveryBlockedReason = recovery.BlockedReason

type RecoveryClock

type RecoveryClock interface {
	Now() time.Time
	Wait(context.Context, time.Duration) error
}

type RecoveryDiscardReport

type RecoveryDiscardReport = recovery.DiscardReport

type RecoveryDiscardResult

type RecoveryDiscardResult = recovery.DiscardResult

type RecoveryDiscardStatus

type RecoveryDiscardStatus = recovery.DiscardStatus

type RecoveryFailure

type RecoveryFailure = recovery.Failure

func RecoveryDestinationFailure

func RecoveryDestinationFailure(err error) *RecoveryFailure

type RecoveryFailureDetail

type RecoveryFailureDetail = recovery.FailureDetail

type RecoveryFailureKind

type RecoveryFailureKind = recovery.FailureKind

type RecoveryInventory

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

RecoveryInventory retains only listed identity evidence. The destination is reacquired for each discard, so a prompt never holds a filesystem lease.

func (*RecoveryInventory) CheckDiscard

func (inventory *RecoveryInventory) CheckDiscard(id receivecontract.OperationID) *RecoveryFailure

func (*RecoveryInventory) Discard

func (*RecoveryInventory) DiscardRestriction

func (inventory *RecoveryInventory) DiscardRestriction() *RecoveryFailure

func (*RecoveryInventory) Observations

func (inventory *RecoveryInventory) Observations() <-chan Observation

Observations is complete when InspectRecovery returns. Draining or ignoring this bounded history has no effect on subsequent identity-bound discard.

func (*RecoveryInventory) Snapshot

func (inventory *RecoveryInventory) Snapshot() (RecoverySnapshot, error)

type RecoveryObservation

type RecoveryObservation = recovery.Observation

type RecoveryOperation

type RecoveryOperation = recovery.Operation

type RecoveryOperationState

type RecoveryOperationState = recovery.OperationState

type RecoveryPhase

type RecoveryPhase = recovery.Phase

type RecoverySnapshot

type RecoverySnapshot = recovery.Snapshot

func NewRecoverySnapshot

func NewRecoverySnapshot(operations []RecoveryOperation, registryUnknown bool) (RecoverySnapshot, error)

type RelayAvailability added in v0.1.6

type RelayAvailability struct {
	Available uint32 `json:"available"`
	Total     uint32 `json:"total"`
	EverReady bool   `json:"ever_ready"`
	Terminal  uint32 `json:"terminal"`
}

RelayAvailability reports current relay admission counts for a live share.

func (RelayAvailability) DiagnosticRecord added in v0.1.6

func (a RelayAvailability) DiagnosticRecord() diagnostics.Record

func (RelayAvailability) EngineEvent added in v0.1.6

func (RelayAvailability) EngineEvent()

type RelayConnected added in v0.1.6

type RelayConnected struct {
	Origin RelayOrigin
}

func (RelayConnected) DiagnosticRecord added in v0.1.6

func (e RelayConnected) DiagnosticRecord() diagnostics.Record

func (RelayConnected) EngineEvent added in v0.1.6

func (RelayConnected) EngineEvent()

type RelayOrigin added in v0.1.6

type RelayOrigin struct {
	Scheme string `json:"scheme"`
	Host   string `json:"host"`
	Port   uint16 `json:"port"`
}

RelayOrigin retains only scheme/host/port so logs and UI never see relay paths, query parameters, or embedded credentials.

func NormalizeRelayOrigin

func NormalizeRelayOrigin(raw string) (RelayOrigin, error)

func (RelayOrigin) HostPort added in v0.1.6

func (o RelayOrigin) HostPort() string

func (RelayOrigin) Valid added in v0.1.6

func (o RelayOrigin) Valid() bool

type RelayRecovery added in v0.1.6

type RelayRecovery struct {
	Origin            RelayOrigin
	Attempt           uint32
	State             RelayRecoveryState
	Failure           *Failure
	WaitReason        RelayWaitReason
	Authorization     serviceauthority.AdmissionState
	ShareInstance     [16]byte
	Generation        uint64
	Slow              bool
	Resume            bool
	Terminal          bool
	NextDelay         time.Duration
	ProtocolSessionID [16]byte
}

func (RelayRecovery) DiagnosticRecord added in v0.1.6

func (e RelayRecovery) DiagnosticRecord() diagnostics.Record

func (RelayRecovery) EngineEvent added in v0.1.6

func (RelayRecovery) EngineEvent()

type RelayRecoveryState added in v0.1.6

type RelayRecoveryState string
const (
	RelayRecoveryStarted   RelayRecoveryState = "started"
	RelayRecoverySucceeded RelayRecoveryState = "succeeded"
	RelayRecoveryFailed    RelayRecoveryState = "failed"
	RelayRecoveryWaiting   RelayRecoveryState = "waiting"
)

type RelaySetupProgress

type RelaySetupProgress = relaysetup.Progress

type RelaySetupRequest

type RelaySetupRequest = relaysetup.Request

type RelaySetupResult

type RelaySetupResult = relaysetup.Result

type RelayWaitReason added in v0.1.6

type RelayWaitReason string
const (
	RelayWaitConnection RelayWaitReason = ""
	RelayWaitBandwidth  RelayWaitReason = "bandwidth"
)

type SelectionCollision added in v0.1.6

type SelectionCollision struct {
	FirstPath  string `json:"first_path"`
	SecondPath string `json:"second_path"`
}

type ShareAuthorization

type ShareAuthorization struct {
	Kind     ShareAuthorizationKind `json:"kind"`
	RelayURL string                 `json:"relay_url,omitempty"`
}

type ShareAuthorizationKind

type ShareAuthorizationKind string
const (
	ShareSelfHostedAuthorization ShareAuthorizationKind = "self_hosted"
	ShareOfficialAuthorization   ShareAuthorizationKind = "official"
)

type ShareDependencies

type ShareDependencies struct {
	Prepare     func(context.Context, liveshare.SenderConfig) (PreparedShare, error)
	Relays      func(context.Context, []relayprofile.Registration) (ShareRelays, error)
	Peers       func() (SharePeers, error)
	PollNetwork func(context.Context, func())
}

Dependencies expose construction seams; task control and aggregate budgets are assigned by the Engine so an injected constructor cannot replace another task's ownership.

type SharePeers

type SharePeers = share.Peers

type ShareReady

type ShareReady struct {
	Capability          link.Link
	SelectedRootSummary liveshare.SelectedRootSummary
	RelayOrigin         RelayOrigin
	FrozenCandidates    []networkconfig.Candidate
	InitialAdmissions   []string
	Frontend            string
	// AlternateFrontend is set only when the share uses a built-in network
	// frontend and another distinct built-in entry exists for the same share.
	AlternateFrontend string
	Decision          networkconfig.Decision
}

type ShareRelayCandidate

type ShareRelayCandidate = relayprofile.Registration

type ShareRelays

type ShareRelays = share.Relays

type ShareRequest

type ShareRequest struct {
	TURNServices []relayconfig.TURNService
	Source       liveshare.FileSourceFactory
	RelayIntent  relayprofile.Intent
	Frontend     string
	ChunkSize    uint32
	Diagnostics  diagnostics.Sink
}

type ShareResult

type ShareResult = share.Result

type ShareSessionFactory

type ShareSessionFactory = share.SessionFactory

type ShareSnapshot

type ShareSnapshot struct {
	State             TaskState
	Startup           ShareStartupState
	Ready             ShareReady
	StartupError      error
	Authorization     *ShareAuthorization
	RelayAvailability *RelayAvailability
	SourceOmissions   *ShareSourceOmissions
	// Result is present only after Done closes: all task work has joined.
	Result *TaskResult[ShareResult]
}

ShareSnapshot separates retained startup from lifecycle and current relay admission. Existing P2P transfers do not depend on relay availability.

type ShareSourceOmissions added in v0.1.6

type ShareSourceOmissions struct {
	Count   uint64
	Samples []catalog.SourceOmission
}

ShareSourceOmissions retains the cumulative count and bounded examples of entries skipped across directories discovered so far during a share.

type ShareStartupState

type ShareStartupState uint8
const (
	SharePreparing ShareStartupState = iota
	ShareAwaitingAuthorization
	ShareReadyReached
	ShareStartupFailed
)

type ShareTask

type ShareTask struct {
	*Task[ShareResult]
	// contains filtered or unexported fields
}

func (*ShareTask) CancelBeforeReady added in v0.1.4

func (current *ShareTask) CancelBeforeReady() bool

CancelBeforeReady reserves cancellation of an unpublished attempt. Once a link is ready, only the ordinary share stop operation can withdraw it.

func (*ShareTask) Ready

func (current *ShareTask) Ready(ctx context.Context) (ShareReady, error)

Ready waits for the first relay registration and local session admission to start. No receiver, P2P connection, or directory scan is required. The retained result is a startup milestone, not a live availability check; canceling this wait does not stop the share. Call StopShare and Wait to stop and join its work.

func (*ShareTask) Snapshot

func (current *ShareTask) Snapshot() ShareSnapshot

func (*ShareTask) StopShare

func (current *ShareTask) StopShare()

type SleepInhibitor added in v0.1.6

type SleepInhibitor interface {
	InhibitSleep(reason string) (release func(), err error)
}

SleepInhibitor prevents idle OS system sleep while active transfers run (display sleep and screen lock remain allowed). Hosts inject platform-native implementations so engine packages remain OS-agnostic.

type SourceOmissions added in v0.1.6

type SourceOmissions struct {
	Summary catalog.SourceOmissions
}

func (SourceOmissions) DiagnosticRecord added in v0.1.6

func (e SourceOmissions) DiagnosticRecord() diagnostics.Record

func (SourceOmissions) EngineEvent added in v0.1.6

func (SourceOmissions) EngineEvent()

type StopReason

type StopReason = task.StopReason

type Task

type Task[T any] struct {
	// contains filtered or unexported fields
}

func (*Task[T]) Cancel

func (current *Task[T]) Cancel()

func (*Task[T]) Changes

func (current *Task[T]) Changes() <-chan struct{}

func (*Task[T]) Done

func (current *Task[T]) Done() <-chan struct{}

func (*Task[T]) ID

func (current *Task[T]) ID() TaskID

func (*Task[T]) Observations

func (current *Task[T]) Observations() <-chan Observation

func (*Task[T]) State

func (current *Task[T]) State() TaskState

func (*Task[T]) Wait

func (current *Task[T]) Wait(ctx context.Context) (TaskResult[T], error)

type TaskCompletion

type TaskCompletion[T any] = task.Completion[T]

type TaskID

type TaskID = task.ID

type TaskLifecycle added in v0.1.6

type TaskLifecycle struct {
	TaskID         TaskID
	Workflow       string
	At             time.Time
	Stage          string
	StopReason     string
	Outcome        string
	FailureClass   string
	Failure        *Failure
	CleanupFailure *Failure
}

func (TaskLifecycle) DiagnosticRecord added in v0.1.6

func (e TaskLifecycle) DiagnosticRecord() diagnostics.Record

func (TaskLifecycle) EngineEvent added in v0.1.6

func (TaskLifecycle) EngineEvent()

type TaskResult

type TaskResult[T any] = task.Result[T]

type TaskSettlement

type TaskSettlement = task.Settlement

type TaskState

type TaskState = task.State

type TransferProgress added in v0.1.6

type TransferProgress struct {
	Operation           receivecontract.OperationID
	Job                 transfer.TransferJobID
	Snapshot            transfer.ReceiveProgressSnapshot
	CapacityWaitVisible bool
}

func (TransferProgress) DiagnosticRecord added in v0.1.6

func (e TransferProgress) DiagnosticRecord() diagnostics.Record

func (TransferProgress) EngineEvent added in v0.1.6

func (TransferProgress) EngineEvent()

type Transport added in v0.1.6

type Transport string
const (
	TransportRelay  Transport = "relay"
	TransportWebRTC Transport = "webrtc"
)

type UnreleasedResourcesError

type UnreleasedResourcesError struct {
	CatalogUsage catalog.ResourceUsage
	CacheBytes   uint64
	// contains filtered or unexported fields
}

UnreleasedResourcesError identifies authority still charged after all tasks have settled. It prevents an ownership defect from becoming a clean shutdown.

func (*UnreleasedResourcesError) Error

func (failure *UnreleasedResourcesError) Error() string

func (*UnreleasedResourcesError) Unwrap

func (failure *UnreleasedResourcesError) Unwrap() error

type Warning added in v0.1.6

type Warning struct {
	Failure Failure
}

func (Warning) DiagnosticRecord added in v0.1.6

func (e Warning) DiagnosticRecord() diagnostics.Record

func (Warning) EngineEvent added in v0.1.6

func (Warning) EngineEvent()

Directories

Path Synopsis
Package account coordinates official-service credentials outside relay handshakes.
Package account coordinates official-service credentials outside relay handshakes.
Package builtinnetwork is application wiring, never an engine default.
Package builtinnetwork is application wiring, never an engine default.
internal
configjson
Package configjson decodes configuration objects whose member names are case-insensitive, including provider-owned JSON nested in a document.
Package configjson decodes configuration objects whose member names are case-insensitive, including provider-owned JSON nested in a document.
nativeconnectivity
Package nativeconnectivity assembles the native peer transport used by application workflows.
Package nativeconnectivity assembles the native peer transport used by application workflows.
networkruntime
Package networkruntime assembles directory trust, recent connection facts and frontend health without giving library callers implicit infrastructure.
Package networkruntime assembles directory trust, recent connection facts and frontend health without giving library callers implicit infrastructure.
receive
Package receive owns one receive operation across connection generations.
Package receive owns one receive operation across connection generations.
share
Package share owns native sender application orchestration.
Package share owns native sender application orchestration.
statefile
Package statefile owns private atomic files and recoverable local commits.
Package statefile owns private atomic files and recoverable local commits.
task
Package task owns one native operation's cancellation and durable completion.
Package task owns one native operation's cancellation and durable completion.
Package networkconfig describes application-injected network and frontend trust.
Package networkconfig describes application-injected network and frontend trust.
Package networkdirectory owns signed network snapshots, bounded refresh and durable rollback protection.
Package networkdirectory owns signed network snapshots, bounded refresh and durable rollback protection.
Package output owns destination acquisition and receive output contracts.
Package output owns destination acquisition and receive output contracts.
Package relayconfig owns saved profiles, active relay selection and frontend choice.
Package relayconfig owns saved profiles, active relay selection and frontend choice.
Package relayprofile describes application relay selection and saved service credentials.
Package relayprofile describes application relay selection and saved service credentials.
Package relaysetup implements discover, approve and install for native applications.
Package relaysetup implements discover, approve and install for native applications.
Package turnissuer resolves the immutable TURN configuration selected by a share.
Package turnissuer resolves the immutable TURN configuration selected by a share.

Jump to

Keyboard shortcuts

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