Documentation
¶
Overview ¶
Package route owns synchronous decisions over one room's media route graph, its single in-flight route operation, the quality/opportunity ledgers and the privacy-safe diagnostic snapshot.
The controller starts no timers, never locks and returns resource effects to its caller. Optional diagnostics invoke the injected sink synchronously. Every method is a state transition over the nowMs the caller passes in; the caller (signal.Server) holds the global mutex around every call and releases exactly the *Resource values a method returns, in order.
Resources are compared by pointer identity. Invalid graphs, reservations or constructor options are programming errors and panic; ordinary unavailable routes remain decision outcomes.
Index ¶
- type AdoptDirectConnectionInput
- type BeginInput
- type BeginResult
- type CandidateCursorGuard
- type CandidateGuard
- type CandidatePlan
- type CandidateProof
- type CandidateReservation
- type CandidateTuple
- type CommittedEdge
- type ConnectionAttemptProgress
- type Controller
- func (c *Controller) AdoptDirectConnection(input AdoptDirectConnectionInput, nowMs int64) SettleResult
- func (c *Controller) BeginCurrentCandidate(input BeginInput) BeginResult
- func (c *Controller) CandidateFailed(guard CandidateGuard, nowMs int64) SettleResult
- func (c *Controller) CandidateReady(guard CandidateGuard, nowMs int64, ...) SettleResult
- func (c *Controller) CandidateTransportConnected(guard CandidateGuard, nowMs int64) SettleResult
- func (c *Controller) ConfirmDeparture(peerID string, nowMs *int64) bool
- func (c *Controller) DiagnosticParticipantLabel(peerID string) string
- func (c *Controller) DisconnectSession(peerID, sessionID string) bool
- func (c *Controller) Dispose() []*Resource
- func (c *Controller) InvalidateDirectEdgeFromParent(input ParentEdgeGuard, nowMs *int64) bool
- func (c *Controller) InvalidateEdge(guard EdgeGuard, nowMs *int64) bool
- func (c *Controller) InvalidateHostPublication(guard PublicationGuard, nowMs *int64) bool
- func (c *Controller) NoteCurrentCandidateRejection(guard CandidateCursorGuard, bucket RejectionBucket) bool
- func (c *Controller) ObserveQualityEvidence(input RouteQualityEvidenceInput) RouteQualityEvidenceResult
- func (c *Controller) ObserveSenderQualityEvidence(input SenderQualityEvidenceInput, ...) SenderQualityEvidenceResult
- func (c *Controller) ObserveSfuPublisherQualityEvidence(input SfuPublisherQualityEvidenceInput, ...) SenderQualityEvidenceResult
- func (c *Controller) Operation() *OperationSnapshot
- func (c *Controller) OperationExpired(nowMs int64) SettleResult
- func (c *Controller) Publication() *HostPublication
- func (c *Controller) RebindHostIdentity(peerID, sessionID string, nowMs *int64) []*Resource
- func (c *Controller) Reconcile(nowMs int64) ReconcileResult
- func (c *Controller) ResetSenderQuality(parentPeerID, parentSessionID string, nowMs int64) []*Resource
- func (c *Controller) RetireCurrentCandidateProducer(guard CandidateCursorGuard, nowMs int64) BeginResult
- func (c *Controller) RetireHostPublication(guard PublicationGuard) []*Resource
- func (c *Controller) Revision() int64
- func (c *Controller) RouteDiagnosticSnapshot(nowMs int64) protocol.RouteDiagnosticSnapshot
- func (c *Controller) SetEffectiveCapacity(peerID, sessionID string, value int, nowMs *int64) bool
- func (c *Controller) SetPaused(paused bool, nowMs *int64) []*Resource
- func (c *Controller) SkipCurrentCandidate(guard CandidateCursorGuard, nowMs int64, bucket RejectionBucket) BeginResult
- func (c *Controller) Snapshot() RouteSnapshot
- func (c *Controller) TouchExternalFacts()
- func (c *Controller) UpsertParticipant(input ParticipantInput, nowMs *int64) []*Resource
- type CurrentAttempt
- type DemandReason
- type EdgeGuard
- type EndpointRetirement
- type EndpointTransition
- type FinalRoute
- type HostPublication
- type OperationSnapshot
- type Options
- type ParentEdgeGuard
- type ParticipantInput
- type PublicationGuard
- type PublicationPlan
- type QualityUpstream
- type ReconcileResult
- type RejectionBucket
- type ReservationKind
- type Resource
- type ResourceKind
- type RetirementKind
- type RouteQualityEvidenceInput
- type RouteQualityEvidenceResult
- type RouteSnapshot
- type SenderQualityEvidenceInput
- type SenderQualityEvidenceResult
- type SenderQualityState
- type SettleResult
- type SfuPublisherQualityEvidenceInput
- type TransitionKind
- type Transport
- type UpstreamKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdoptDirectConnectionInput ¶
AdoptDirectConnectionInput is an EdgeGuard plus the replacement connection. TS: EdgeGuard & { newConnectionId }.
type BeginInput ¶
type BeginInput struct {
Guard CandidateCursorGuard
NowMs int64
ConnectionID string
Reservation CandidateReservation
PublicationGeneration string
PublicationConnectionID string
HostSessionID string
}
BeginInput is the BeginCurrentCandidate input. PublicationGeneration and PublicationConnectionID are required for sfu create/replace tuples; HostSessionID is required for every SFU tuple (empty = TS undefined, rejected the same way). TS: the inline input of beginCurrentCandidate.
type BeginResult ¶
type BeginResult struct {
Accepted bool
Operation *OperationSnapshot
FailedPeerIDs []string
Released []*Resource
}
BeginResult is the outcome of the cursor-guarded candidate calls.
type CandidateCursorGuard ¶
type CandidateCursorGuard struct {
ChildPeerID string
ChildSessionID string
BaseRevision int64
FactVersion int64
Cursor int
Plan CandidatePlan
}
CandidateCursorGuard identifies one candidate slot of the current operation: it must still be at Cursor with an equal Plan, built at FactVersion on BaseRevision. TS: CandidateCursorGuard.
type CandidateGuard ¶
type CandidateGuard struct {
ChildPeerID string
ChildSessionID string
Revision int64
ConnectionID string
}
CandidateGuard identifies the live attempt exactly. TS: CandidateGuard.
type CandidatePlan ¶
type CandidatePlan struct {
Tuple CandidateTuple
EndpointTransition EndpointTransition
}
CandidatePlan is a tuple with its endpoint transition. TS: CandidatePlan.
type CandidateProof ¶
type CandidateProof struct {
RelativeQualityApproved bool
}
CandidateProof carries the Viewer's one-shot relative quality approval.
type CandidateReservation ¶
type CandidateReservation struct {
Kind ReservationKind
Edge *Resource
Publication *Resource
Borrowed bool
Overlap *Resource
}
CandidateReservation is what the caller allocated before BeginCurrentCandidate. Edge/Publication are set per Kind (direct: neither; sfu-reuse: Edge, Borrowed when it is another holder's live subscription and must not be released; sfu-create: Edge and Publication). Overlap is optional for every kind. TS: CandidateReservation.
type CandidateTuple ¶
type CandidateTuple struct {
Kind UpstreamKind
ParentPeerID string
Transport Transport
Regenerate bool
Publication PublicationPlan
}
CandidateTuple is one route candidate: a direct edge from ParentPeerID (Kind UpstreamPeer, Transport always TransportDirect, Regenerate = rebuild the same edge with a fresh connection) or an SFU edge (Kind UpstreamSfu, Publication set). TS: CandidateTuple.
type CommittedEdge ¶
type CommittedEdge struct {
Kind UpstreamKind
ChildSessionID string
ParentPeerID string
ParentSessionID string
PublicationGeneration string
Transport Transport
ConnectionID string
Usable bool
PhysicalActive bool
Resource *Resource
}
CommittedEdge is a child's one upstream edge in the committed graph. Peer edges (Kind UpstreamPeer) set ParentPeerID/ParentSessionID and leave Resource nil; SFU edges (Kind UpstreamSfu) set PublicationGeneration and Resource. TS: CommittedEdge.
type ConnectionAttemptProgress ¶
ConnectionAttemptProgress is the NAT-prediction attempt counter (initial attempt plus retries; the controller owns Total).
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller never locks: the caller holds signal.Server.mu around every call.
func New ¶
func New(options Options) *Controller
New ports the constructor: panics with "Endpoint media copy capacity must be 1, 2, or 3" or "Route operation timeout must be a positive integer".
func (*Controller) AdoptDirectConnection ¶
func (c *Controller) AdoptDirectConnection(input AdoptDirectConnectionInput, nowMs int64) SettleResult
AdoptDirectConnection accepts a replacement for the exact active edge. Recovery supersedes optional preparation for that child when the replacement arrives. Required availability work, including capacity reduction, keeps priority.
func (*Controller) BeginCurrentCandidate ¶
func (c *Controller) BeginCurrentCandidate(input BeginInput) BeginResult
BeginCurrentCandidate starts the candidate at the guarded cursor with the caller's reservation; every rejection echoes the reservation back in Released. Panics on a reservation that does not match the tuple.
func (*Controller) CandidateFailed ¶
func (c *Controller) CandidateFailed(guard CandidateGuard, nowMs int64) SettleResult
CandidateFailed fails the guarded live attempt, releasing its reservation and advancing the cursor; Accepted reports whether the guard was consumed.
func (*Controller) CandidateReady ¶
func (c *Controller) CandidateReady(guard CandidateGuard, nowMs int64, commitReservation func(CandidateReservation) bool, proof CandidateProof) SettleResult
CandidateReady is the commit gate for the guarded live attempt: commits when the required proof is present and commitReservation (nil = always true) accepts, fails the candidate otherwise.
func (*Controller) CandidateTransportConnected ¶
func (c *Controller) CandidateTransportConnected(guard CandidateGuard, nowMs int64) SettleResult
CandidateTransportConnected marks the guarded peer attempt as connected so it survives the direct head start until the operation deadline.
func (*Controller) ConfirmDeparture ¶
func (c *Controller) ConfirmDeparture(peerID string, nowMs *int64) bool
ConfirmDeparture finalises a viewer's departure (capacity 0, demand recorded for its children when nowMs is non-nil); false for the Host or an unknown peer; idempotent.
func (*Controller) DiagnosticParticipantLabel ¶
func (c *Controller) DiagnosticParticipantLabel(peerID string) string
DiagnosticParticipantLabel returns "host", "viewer-<joinOrder>" or "viewer-unknown" for a peer ID without exposing the ID.
func (*Controller) DisconnectSession ¶
func (c *Controller) DisconnectSession(peerID, sessionID string) bool
DisconnectSession marks the participant's exact session as gone (grace state, no revision change); false when the session does not match.
func (*Controller) Dispose ¶
func (c *Controller) Dispose() []*Resource
Dispose clears all state, pauses the controller and returns the live reservation's resources then every committed resource, deduplicated.
func (*Controller) InvalidateDirectEdgeFromParent ¶
func (c *Controller) InvalidateDirectEdgeFromParent(input ParentEdgeGuard, nowMs *int64) bool
InvalidateDirectEdgeFromParent invalidates the first committed direct edge (insertion order) matching the parent-side guard.
func (*Controller) InvalidateEdge ¶
func (c *Controller) InvalidateEdge(guard EdgeGuard, nowMs *int64) bool
InvalidateEdge marks the exactly identified edge unusable and records an "edge-unavailable" demand; true when the guard matched (idempotent).
func (*Controller) InvalidateHostPublication ¶
func (c *Controller) InvalidateHostPublication(guard PublicationGuard, nowMs *int64) bool
InvalidateHostPublication marks the identified publication unusable and records demand for every SFU child; true when the guard matched (idempotent).
func (*Controller) NoteCurrentCandidateRejection ¶
func (c *Controller) NoteCurrentCandidateRejection(guard CandidateCursorGuard, bucket RejectionBucket) bool
NoteCurrentCandidateRejection records a rejection bucket for the guarded cursor while no attempt is live; true when the guard matched.
func (*Controller) ObserveQualityEvidence ¶
func (c *Controller) ObserveQualityEvidence(input RouteQualityEvidenceInput) RouteQualityEvidenceResult
ObserveQualityEvidence aggregates one receiver-side window onto the child's committed edge: rejected on any mismatch, accepted when consumed without aggregation, observed when aggregated.
func (*Controller) ObserveSenderQualityEvidence ¶
func (c *Controller) ObserveSenderQualityEvidence(input SenderQualityEvidenceInput, commitReservation func(CandidateReservation) bool) SenderQualityEvidenceResult
ObserveSenderQualityEvidence records a parent's health sample for a child, settling the live quality/root candidate when the sample names it; a nil commitReservation always commits. Requires QualityConvergenceEnabled.
func (*Controller) ObserveSfuPublisherQualityEvidence ¶
func (c *Controller) ObserveSfuPublisherQualityEvidence(input SfuPublisherQualityEvidenceInput, commitReservation func(CandidateReservation) bool) SenderQualityEvidenceResult
ObserveSfuPublisherQualityEvidence records a Host->SFU ingress sample, settling a live sfu/reuse quality candidate; a nil commitReservation always commits. Requires QualityConvergenceEnabled. Unlike the other two observers it validates no numbers.
func (*Controller) Operation ¶
func (c *Controller) Operation() *OperationSnapshot
Operation is Snapshot().Operation without the graph copy: a deep copy of the in-flight operation, or nil when the controller is idle.
func (*Controller) OperationExpired ¶
func (c *Controller) OperationExpired(nowMs int64) SettleResult
OperationExpired applies head-start and deadline expiry at nowMs; Accepted reports whether something expired.
func (*Controller) Publication ¶
func (c *Controller) Publication() *HostPublication
Publication is Snapshot().HostPublication without the graph copy: a copy of the single live SFU ingress, or nil when there is none.
func (*Controller) RebindHostIdentity ¶
func (c *Controller) RebindHostIdentity(peerID, sessionID string, nowMs *int64) []*Resource
RebindHostIdentity moves the Host to a new peer ID (same ID delegates to UpsertParticipant), tearing down the whole graph and returning every SFU subscription, the publication and the aborted reservation, deduplicated.
func (*Controller) Reconcile ¶
func (c *Controller) Reconcile(nowMs int64) ReconcileResult
Reconcile validates or advances the current operation, prunes departed leaves and starts at most one new operation in strict priority (sfu-bootstrap carrier, next child, direct continuation, quality child, root convergence).
func (*Controller) ResetSenderQuality ¶
func (c *Controller) ResetSenderQuality(parentPeerID, parentSessionID string, nowMs int64) []*Resource
ResetSenderQuality drops the parent's sender observations, baselines and regeneration latches and aborts an operation whose live candidate that parent owns; empty unless the parent's session matches.
func (*Controller) RetireCurrentCandidateProducer ¶
func (c *Controller) RetireCurrentCandidateProducer(guard CandidateCursorGuard, nowMs int64) BeginResult
RetireCurrentCandidateProducer performs the bounded-gap retirement of the guarded candidate's producer, advances the revision and replans the tail.
func (*Controller) RetireHostPublication ¶
func (c *Controller) RetireHostPublication(guard PublicationGuard) []*Resource
RetireHostPublication retires the physically active publication and its subscriptions when no attempt is live and the guard matches, returning the subscriptions then the publication resource; empty otherwise.
func (*Controller) Revision ¶
func (c *Controller) Revision() int64
Revision is Snapshot().Revision without the graph copy, for the callers that only compare revisions before and after a mutation.
func (*Controller) RouteDiagnosticSnapshot ¶
func (c *Controller) RouteDiagnosticSnapshot(nowMs int64) protocol.RouteDiagnosticSnapshot
RouteDiagnosticSnapshot returns the privacy-safe snapshot: connected viewers sorted by join order with snapshot-local ordinals and relative durations; operation is nil unless its demand peer has an ordinal.
func (*Controller) SetEffectiveCapacity ¶
func (c *Controller) SetEffectiveCapacity(peerID, sessionID string, value int, nowMs *int64) bool
SetEffectiveCapacity clamps and stores the participant's downstream capacity for the matching session; true even when unchanged (facts are touched only on change).
func (*Controller) SetPaused ¶
func (c *Controller) SetPaused(paused bool, nowMs *int64) []*Resource
SetPaused pauses (aborting the operation and clearing quality state) or resumes; returns the aborted reservation's resources.
func (*Controller) SkipCurrentCandidate ¶
func (c *Controller) SkipCurrentCandidate(guard CandidateCursorGuard, nowMs int64, bucket RejectionBucket) BeginResult
SkipCurrentCandidate consumes the guarded candidate and advances the cursor (TS defaulted bucket to "stale"; Go callers pass RejectionStale).
func (*Controller) Snapshot ¶
func (c *Controller) Snapshot() RouteSnapshot
Snapshot returns a copy of the committed graph, the publication and the operation snapshot; it mutates nothing.
func (*Controller) TouchExternalFacts ¶
func (c *Controller) TouchExternalFacts()
TouchExternalFacts reopens every SFU opportunity after an external fact change (for example a share generation) and bumps the fact version.
func (*Controller) UpsertParticipant ¶
func (c *Controller) UpsertParticipant(input ParticipantInput, nowMs *int64) []*Resource
UpsertParticipant adds or updates a participant, aborting an operation that used a replaced session; a viewer without a usable route records a "join" demand when nowMs is non-nil. Panics on a Host/role inconsistency.
type CurrentAttempt ¶
type CurrentAttempt struct {
Tuple CandidateTuple
Revision int64
ConnectionID string
ConnectionAttempt *ConnectionAttemptProgress
}
CurrentAttempt is OperationSnapshot.current: the live candidate attempt. ConnectionAttempt is nil when the attempt has no NAT opportunity.
type DemandReason ¶
type DemandReason string
DemandReason mirrors protocol RouteDemandReason.
const ( DemandJoin DemandReason = "join" DemandParentDeparted DemandReason = "parent-departed" DemandCapacityReduction DemandReason = "capacity-reduction" DemandSfuBootstrap DemandReason = "sfu-bootstrap" DemandDirectConvergence DemandReason = "direct-convergence" DemandQualityConvergence DemandReason = "quality-convergence" DemandRootConvergence DemandReason = "root-convergence" )
Demand reasons.
type EdgeGuard ¶
type EdgeGuard struct {
ChildPeerID string
ChildSessionID string
RouteRevision int64
ConnectionID string
ParentSessionID string
}
EdgeGuard identifies one committed edge exactly. ParentSessionID is only compared for peer edges; callers pass the edge's own ParentSessionID for those and leave it empty for SFU edges. TS: EdgeGuard.
type EndpointRetirement ¶
type EndpointRetirement struct {
Kind RetirementKind
ChildPeerID string
ChildSessionID string
ParentPeerID string
ParentSessionID string
Transport Transport
ConnectionID string
HostSessionID string
Generation string
}
EndpointRetirement is the producer retirement a bounded-gap transition requires: an existing direct edge (RetireEdge: Child*/Parent*/Transport/ ConnectionID) or the Host publication (RetirePublication: HostSessionID/ Generation/ConnectionID). TS: EndpointRetirement.
type EndpointTransition ¶
type EndpointTransition struct {
Kind TransitionKind
ProducerPeerID *string
Retire *EndpointRetirement
}
EndpointTransition says how the producer's copy budget absorbs the candidate. ProducerPeerID is nil only for TransitionNone on an sfu/reuse plan (TS omitted it there and endpointTransitionEquals compares it). Retire is set only for TransitionBoundedGap. TS: EndpointTransition.
type FinalRoute ¶
type FinalRoute string
FinalRoute mirrors protocol RouteDiagnosticFinalRoute.
const ( FinalRouteDirect FinalRoute = "direct" FinalRouteSfu FinalRoute = "sfu" FinalRouteWaiting FinalRoute = "waiting" FinalRouteFailed FinalRoute = "failed" )
Final routes.
type HostPublication ¶
type HostPublication struct {
Generation string
HostSessionID string
ConnectionID string
Usable bool
PhysicalActive bool
Resource *Resource
}
HostPublication is the single live SFU ingress. TS: HostPublication.
type OperationSnapshot ¶
type OperationSnapshot struct {
ChildPeerID string
ChildSessionID string
DemandPeerID string
Reason DemandReason
BaseRevision int64
FactVersion int64
Candidates []CandidatePlan
Cursor int
DeadlineAtMs int64
WakeAtMs int64
Current *CurrentAttempt
}
OperationSnapshot is a deep copy of the in-flight operation plus the derived WakeAtMs. Current is nil without a live attempt. TS: OperationSnapshot.
type Options ¶
type Options struct {
HostPeerID string
DebugRoomID string
// DebugLog receives sanitized route events. nil disables them; the effect
// layer owns environment, logger and retention policy.
DebugLog func(string, ...any)
EndpointMediaCopyCapacity int
OperationTimeoutMs int64
SfuEnabled bool
SfuOnly bool
QualityConvergenceEnabled bool
NatPredictionEnabled bool
}
Options configures a Controller. DebugRoomID empty disables the sanitised route debug events. TS: ControllerOptions.
type ParentEdgeGuard ¶
type ParentEdgeGuard struct {
ParentPeerID string
ParentSessionID string
RouteRevision int64
ConnectionID string
}
ParentEdgeGuard identifies a direct edge from the parent's side.
type ParticipantInput ¶
type ParticipantInput struct {
PeerID string
Role protocol.Role
SessionID string
EffectiveDownstreamCapacity int
}
ParticipantInput describes a connected participant. TS: ParticipantInput.
type PublicationGuard ¶
type PublicationGuard struct {
HostSessionID string
RouteRevision int64
Generation string
ConnectionID string
}
PublicationGuard identifies the Host publication exactly. TS: the inline guard of invalidateHostPublication and retireHostPublication.
type PublicationPlan ¶
type PublicationPlan string
PublicationPlan is the SFU tuple action (TS publication: "reuse" | "create" | "replace").
const ( PublicationReuse PublicationPlan = "reuse" PublicationCreate PublicationPlan = "create" PublicationReplace PublicationPlan = "replace" )
Publication plans.
type QualityUpstream ¶
type QualityUpstream struct {
Kind UpstreamKind
PeerID string
}
QualityUpstream names the upstream a receiver-side window was measured on: PeerID is set only for UpstreamPeer. TS: RouteQualityEvidenceInput.upstream.
type ReconcileResult ¶
type ReconcileResult struct {
Operation *OperationSnapshot
RemovedPeerIDs []string
FailedPeerIDs []string
Released []*Resource
}
ReconcileResult is the scheduler outcome. TS: ReconcileResult.
type RejectionBucket ¶
type RejectionBucket string
RejectionBucket mirrors protocol RouteDiagnosticRejectionBucket.
const ( RejectionNone RejectionBucket = "none" RejectionStale RejectionBucket = "stale" RejectionEndpointCapacity RejectionBucket = "endpoint-capacity" RejectionSfuAdmission RejectionBucket = "sfu-admission" RejectionCandidateFailed RejectionBucket = "candidate-failed" RejectionFirstFrameTimeout RejectionBucket = "first-frame-timeout" RejectionOperationDeadline RejectionBucket = "operation-deadline" RejectionAborted RejectionBucket = "aborted" )
Rejection buckets.
type ReservationKind ¶
type ReservationKind string
ReservationKind discriminates CandidateReservation.
const ( ReservationDirect ReservationKind = "direct" ReservationSfuReuse ReservationKind = "sfu-reuse" ReservationSfuCreate ReservationKind = "sfu-create" )
Reservation kinds.
type Resource ¶
type Resource struct {
Kind ResourceKind
// EndpointPeerID is set for ResourceOverlap.
EndpointPeerID string
// Fence fields (RoomID, ShareGeneration, PublicationGeneration) are set
// for sfu-publication and sfu-subscription; ViewerPeerID only for the
// subscription. All are opaque IDs.
RoomID string
PublicationGeneration string
ViewerPeerID string
ConnectionID string
// Released is flipped by the router once the allocation is freed.
Released bool
}
Resource is the caller-owned SFU/overlap allocation the controller stores, moves between collections and compares by pointer identity (TS: the bare Resource type parameter, always used through JS Set semantics). The controller never reads its fields; they exist for the router and tests.
type ResourceKind ¶
type ResourceKind string
ResourceKind is the RouteResource discriminator of hybrid-media-router.ts.
const ( ResourceOverlap ResourceKind = "overlap" ResourceSfuSubscription ResourceKind = "sfu-subscription" ResourceSfuPublication ResourceKind = "sfu-publication" )
Resource kinds.
type RetirementKind ¶
type RetirementKind string
RetirementKind discriminates EndpointRetirement.
const ( RetireEdge RetirementKind = "edge" RetirePublication RetirementKind = "publication" )
Retirement kinds.
type RouteQualityEvidenceInput ¶
type RouteQualityEvidenceInput struct {
ChildPeerID string
ChildSessionID string
RouteRevision int64
ConnectionID string
Upstream QualityUpstream
PresentationEpoch int64
WindowMs int64
Metrics protocol.ViewerQualityEvidenceMetrics
AcceptedAtMs int64
}
RouteQualityEvidenceInput is one receiver-side quality window. Only FramesDecodedDelta, FreezeCountDelta, FreezeDurationMsDelta, PauseCountDelta and PauseDurationMsDelta of Metrics are read.
type RouteQualityEvidenceResult ¶
type RouteQualityEvidenceResult string
RouteQualityEvidenceResult is the ObserveQualityEvidence outcome.
const ( QualityEvidenceRejected RouteQualityEvidenceResult = "rejected" QualityEvidenceAccepted RouteQualityEvidenceResult = "accepted" QualityEvidenceObserved RouteQualityEvidenceResult = "observed" )
Quality evidence outcomes.
type RouteSnapshot ¶
type RouteSnapshot struct {
Revision int64
Paused bool
FactVersion int64
UpstreamByViewer *ordered.Map[string, CommittedEdge]
HostPublication *HostPublication
Operation *OperationSnapshot
}
RouteSnapshot is the committed graph as the router reads it. UpstreamByViewer is a fresh insertion-ordered copy (child peerId -> edge); HostPublication is a shallow copy or nil; Operation is nil when idle.
type SenderQualityEvidenceInput ¶
type SenderQualityEvidenceInput struct {
ParentPeerID string
ParentSessionID string
ChildPeerID string
RouteRevision int64
ConnectionID string
SenderIdentity *string
SampleTimestampMs *int64
State SenderQualityState
AcceptedAtMs int64
}
SenderQualityEvidenceInput is one sender-side health sample from a parent about one child. SenderIdentity and SampleTimestampMs are nullable.
type SenderQualityEvidenceResult ¶
type SenderQualityEvidenceResult = SettleResult
SenderQualityEvidenceResult is the outcome of the two sender-side observers. TS declares it separately with a required committed flag; the Go shape is identical to SettleResult.
type SenderQualityState ¶
type SenderQualityState string
SenderQualityState is the sender-side health sample state (TS "unknown" | "healthy" | "degraded").
const ( SenderQualityUnknown SenderQualityState = "unknown" SenderQualityHealthy SenderQualityState = "healthy" SenderQualityDegraded SenderQualityState = "degraded" )
Sender quality states.
type SettleResult ¶
type SettleResult struct {
Accepted bool
Committed bool
FailedPeerIDs []string
ActiveRevision int64
Released []*Resource
}
SettleResult is the outcome of candidate settlement or active replacement. Committed is true only when CandidateReady committed the attempt (TS: optional committed, read as truthy by the router). TS: SettleResult.
type SfuPublisherQualityEvidenceInput ¶
type SfuPublisherQualityEvidenceInput struct {
HostPeerID string
HostSessionID string
PublicationGeneration string
RouteRevision int64
State SenderQualityState
SampleTimestampMs *int64
AcceptedAtMs int64
}
SfuPublisherQualityEvidenceInput is one Host->SFU ingress health sample.
type TransitionKind ¶
type TransitionKind string
TransitionKind discriminates EndpointTransition.
const ( TransitionNone TransitionKind = "none" TransitionOverlap TransitionKind = "overlap" TransitionBoundedGap TransitionKind = "bounded-gap" )
Transition kinds.
type Transport ¶
type Transport string
Transport is the edge transport (TS transport: "direct" | "sfu").
type UpstreamKind ¶
type UpstreamKind string
UpstreamKind discriminates CandidateTuple, CommittedEdge, committedEdgeSeed and QualityUpstream (TS kind: "peer" | "sfu").
const ( UpstreamPeer UpstreamKind = "peer" UpstreamSfu UpstreamKind = "sfu" )
Upstream kinds.