engine

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: AGPL-3.0 Imports: 38 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. Share and receive streams expose its normalized EngineTaskObserved fact once, using engine/observation/wire for serialization. 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 typed product state through engine/observation. 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. Diagnostic names and attributes do not extend the product wire contract. 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
	ReceiveRetentionNone            = receive.RetentionNone
	ReceiveRetentionCheckpoints     = receive.RetentionCheckpoints
	ReceiveRetentionLiveReleased    = receive.RetentionLiveReleased
	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
	OutputResumable                  = receive.OutputResumable
	OutputLiveOnly                   = receive.OutputLiveOnly
	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
	ReceiveFailureOutputRecoveryUnavailable     = receive.FailureOutputRecoveryUnavailable
	ReceiveFailureRetainedOutputMissing         = receive.FailureRetainedOutputMissing
	ReceiveFailurePeerConfiguration             = receive.FailurePeerConfiguration
	ReceiveFailurePeerNegotiation               = receive.FailurePeerNegotiation
	ReceiveFailurePeerProtocol                  = receive.FailurePeerProtocol
	ReceiveFailurePeerSignaling                 = receive.FailurePeerSignaling
	ReceiveFailurePeerStopped                   = receive.FailurePeerStopped

	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
	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
)

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 DescribeFailure

func DescribeFailure(cause error) (appobs.Failure, bool)

DescribeFailure also serves adapter-owned failures, such as opening a local output or publishing a link. Task results already carry this normalized fact.

func DescribeFileOutcomes

func DescribeFileOutcomes(value transfer.FileOutcomeSummary) appobs.FileOutcomes

func DescribeProgress

func DescribeProgress(operation receivecontract.OperationID, job transfer.TransferJobID, snapshot transfer.ReceiveProgressSnapshot, capacityVisible bool) (appobs.TransferProgress, error)

func DescribeProgressSnapshot

func DescribeProgressSnapshot(value transfer.ReceiveProgressSnapshot, visible bool) (appobs.ProgressSnapshot, error)

func NormalizeRelayOrigin

func NormalizeRelayOrigin(raw string) (appobs.RelayOrigin, error)

func ObservationLossReason

func ObservationLossReason(cause error) appobs.ObserverLossReason

func ObservationRejection

func ObservationRejection(cause error) appobs.ObservationRejection
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 Config

type Config struct {
	Network             *networkconfig.Config
	TURN                turn.Settings
	TURNDependencies    turn.Dependencies
	RelaySetup          relaysetup.Dependencies
	Now                 func() time.Time
	Random              io.Reader
	CleanupTimeout      time.Duration
	ObservationCapacity observationstream.Capacity
	RevisionCapacity    revisioncapacity.ProcessConfig
	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 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) ConfigureTURN

func (engine *Engine) ConfigureTURN(settings turn.Settings) error

ConfigureTURN atomically publishes manual accounts and managed deployment settings without contacting issuers or resetting Engine-lifetime budgets.

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) QueryTURNUsage

func (engine *Engine) QueryTURNUsage(ctx context.Context, account string, firstDate, lastDate time.Time) (turn.Usage, error)

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)

func (*Engine) TURNStatus

func (engine *Engine) TURNStatus() []turn.Status

type Event

type Event = task.Event

type FailureClass

type FailureClass = task.FailureClass

type LifecycleObservation

type LifecycleObservation = task.Lifecycle

LifecycleObservation is retained for management tasks without a transfer workflow.

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 OutputMode

type OutputMode = receive.OutputMode

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 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 RelaySetupProgress

type RelaySetupProgress = relaysetup.Progress

type RelaySetupRequest

type RelaySetupRequest = relaysetup.Request

type RelaySetupResult

type RelaySetupResult = relaysetup.Result

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         appobs.RelayOrigin
	FrozenCandidates    []networkconfig.Candidate
	InitialAdmissions   []string
	Frontend            string
	Decision            networkconfig.Decision
}

type ShareRelayCandidate

type ShareRelayCandidate = relayprofile.Registration

type ShareRelays

type ShareRelays = share.Relays

type ShareRequest

type ShareRequest struct {
	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 *appobs.RelayAvailability
	// 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 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 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 TaskResult

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

type TaskSettlement

type TaskSettlement = task.Settlement

type TaskState

type TaskState = task.State

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

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.
turnruntime
Package turnruntime owns TURN settings, shared account budgets and demand-driven discovery.
Package turnruntime owns TURN settings, shared account budgets and demand-driven discovery.
turnruntime/internal/provider
Package provider implements credential issuers.
Package provider implements credential issuers.
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 turn exposes application settings, status and observations.
Package turn exposes application settings, status and observations.
Package turncache stores replaceable observations, scoped to relay authority.
Package turncache stores replaceable observations, scoped to relay authority.

Jump to

Keyboard shortcuts

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