share

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: AGPL-3.0 Imports: 32 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package share owns native sender application orchestration.

Index

Constants

This section is empty.

Variables

View Source
var ErrConfiguration = errors.New("invalid share workflow configuration")
View Source
var ErrInvalidChunkSize = errors.New("invalid share block size")

Functions

func Run

func Run(ctx context.Context, request Request, dependencies Dependencies) task.Completion[Result]

Run returns only after every borrower has released source and key authority.

Types

type Controller

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

Controller retains the first service-ready result independently of diagnostic delivery and caller presentation. Closing readyDone publishes immutable state.

func NewController

func NewController() *Controller

func (*Controller) Availability

func (c *Controller) Availability() (relayset.SenderAvailability, bool)

Availability reads the relay owner, not its lossy observation stream.

func (*Controller) Ready

func (c *Controller) Ready(ctx context.Context) (Ready, error)

func (*Controller) Startup

func (c *Controller) Startup() (Ready, error, bool)

Startup never waits and retains failure as well as successful first readiness.

type Dependencies

type Dependencies struct {
	TURN             turnpath.Accounts
	Control          task.Control
	Controller       *Controller
	RevisionCapacity *revisioncapacity.Coordinator
	CatalogBudget    *catalog.BudgetAccount
	CacheBudget      *contentflow.ProcessCacheBudget
	Connectivity     *nativeconnectivity.Capacity
	ICEPool          func() icepolicy.ICEEndpointPool
	Prepare          func(context.Context, liveshare.SenderConfig) (Prepared, error)
	Relays           func(context.Context, []string, relayset.SenderFactory) (Relays, error)
	Relay            func(senderrelay.Config) (Relay, error)
	Peers            func(nativeconnectivity.SenderConfig) (Peers, error)
	PollNetwork      func(context.Context, func())
	Attempts         func(string) senderrelay.AttemptControl
	ObserveAttempt   func(string, senderrelay.Attempt)
}

type Milestone

type Milestone string
const (
	SourceAcquiring         Milestone = "source_acquiring"
	SourceAcquisitionFailed Milestone = "source_acquisition_failed"
	SourceAcquired          Milestone = "source_acquired"
	ShareReady              Milestone = "share_ready"
	ShareStopping           Milestone = "share_stopping"
	ShareStopped            Milestone = "share_stopped"
	SessionRetired          Milestone = "session_retired"
)

type Observation

type Observation struct {
	Milestone         Milestone
	ShareInstance     catalog.ShareInstance
	Session           protocolsession.ProtocolSessionID
	Failure           error
	RelayRecovery     *RelayRecovery
	RelayAvailability *relayset.SenderAvailability
}

func (Observation) DiagnosticRecord

func (value Observation) DiagnosticRecord() diagnostics.Record

func (Observation) EngineEvent

func (Observation) EngineEvent()

type ObservationLoss

type ObservationLoss struct {
	Source  ObservationSource
	Dropped uint64
}

type ObservationSource

type ObservationSource string
const (
	ProtocolObservations ObservationSource = "protocol"

	NativeObservations ObservationSource = "native"

	RelayObservations ObservationSource = "relay"

	WebRTCObservations ObservationSource = "webrtc"

	SenderAttempts ObservationSource = "peer_attempt"

	PeerDiagnostics ObservationSource = "peer_diagnostic"
)

type Peers

type Peers interface {
	sendersession.PeerHandlerFactory
	Close(context.Context) error
}

type Prepared

type Prepared interface {
	AuthorizeRegistration() error
	Registration() liveshare.RegistrationMaterial
	Capability() link.Link
	SelectedRootSummary() liveshare.SelectedRootSummary
	NewRuntimeFactory(liveshare.RuntimeFactoryConfig) (SessionFactory, error)
	// StartRootPrefetch schedules optional work without waiting for a scan.
	StartRootPrefetch()
	Close() error
}

Prepared makes preparation and shutdown independently testable while the production adapter keeps the sender's unique runtime-factory authority.

type Ready

type Ready struct {
	Capability          link.Link
	SelectedRootSummary liveshare.SelectedRootSummary
	RelayEndpoint       v2.RelayEndpoint
	Registrations       relayset.SenderRegistrations
}

type Relay

type Relay interface {
	relayset.SenderEndpoint
	CompleteObservations() relayv2.LifecycleObservationCompletion
}

type RelayRecovery

type RelayRecovery struct {
	Endpoint v2.RelayEndpoint
	Attempt  senderrelay.Attempt
}

type Relays

type Relays interface {
	Accept(context.Context) (protocolsession.FrameChannel, error)
	WaitReady(context.Context) error
	ReadyRelayURL() string
	Wake()
	StopRecovery()
	Cleanup(context.Context) error
}

type Request

type Request struct {
	Source      liveshare.FileSourceFactory
	Relays      []relayprofile.Registration
	ChunkSize   uint32
	Diagnostics diagnostics.Sink
}

type Result

type Result struct {
	Elapsed time.Duration
	// Ready records first service readiness, not availability at shutdown.
	Ready bool
}

type SessionFactory

type SessionFactory interface {
	AdmitChannel(context.Context, protocolsession.FrameChannel) (sendersession.ChannelAdmission, error)
	// Stop freezes admission before returning and joins terminal work on success.
	// An expired wait must remain joinable through a subsequent Stop call.
	Stop(context.Context, string) error
}

type SourceOmissionsObserved

type SourceOmissionsObserved struct{ Summary catalog.SourceOmissions }

func (SourceOmissionsObserved) EngineEvent

func (SourceOmissionsObserved) EngineEvent()

Jump to

Keyboard shortcuts

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