Documentation
¶
Overview ¶
Package clusterplayback composes exact source authority and fenced HLS execution.
Index ¶
- Constants
- Variables
- func IsPublicRepresentation(q *http.Request) bool
- func Supports(q core.HLSRequest) bool
- type Assignment
- type Coordinator
- type Options
- type OutputBufferSnapshot
- type PlaybackDisplay
- type PreparationReceipt
- type PrepareRequest
- type PreparedSource
- type ProtocolSealer
- type RecoveryEvent
- type RecoveryEventReader
- type RemotePlayback
- func (p *RemotePlayback) BindClientSession(ctx context.Context, session, playID string) error
- func (p *RemotePlayback) CheckFileAvailability(ctx context.Context, u *core.User, k core.RatingKey, caps core.ClientCaps, ...) (bool, error)
- func (p *RemotePlayback) CurrentSource(c context.Context, id string) (core.PlaybackSourceObservation, error)
- func (p *RemotePlayback) Estimate(c context.Context, t *core.Title, caps core.ClientCaps) core.MediaInfo
- func (p *RemotePlayback) Failover(context.Context, string, time.Duration) (*core.PlaySession, error)
- func (p *RemotePlayback) InputURL(string) string
- func (p *RemotePlayback) MarkSurfaceOpened(id string) bool
- func (p *RemotePlayback) MarkSurfacePrepared(id string) bool
- func (p *RemotePlayback) OpenRemoteSource(ctx context.Context, id string) error
- func (p *RemotePlayback) PinSourceRevision(c context.Context, id, rev string) error
- func (p *RemotePlayback) PlaybackProgress(viewer int64, client string, key core.RatingKey, position time.Duration, ...)
- func (p *RemotePlayback) Prepare(c context.Context, v *core.User, k core.RatingKey, caps core.ClientCaps) (*core.PlaySession, error)
- func (p *RemotePlayback) PrepareSurface(c context.Context, v *core.User, k core.RatingKey, caps core.ClientCaps, ...) (*core.PlaySession, error)
- func (p *RemotePlayback) PrepareSurfaceSource(c context.Context, v *core.User, k core.RatingKey, caps core.ClientCaps, ...) (*core.PlaySession, core.SourceRetirement, error)
- func (p *RemotePlayback) RestoreNeutralSource(ctx context.Context, id string, snapshot core.PlaySession) error
- func (p *RemotePlayback) RestorePlexSource(ctx context.Context, id string, snapshot core.PlaySession) error
- func (p *RemotePlayback) RetireSource(id string, life core.SourceRetirement) error
- func (p *RemotePlayback) RevalidateSession(ctx context.Context, id string) error
- func (p *RemotePlayback) ServeRange(w http.ResponseWriter, q *http.Request, id string)
- func (p *RemotePlayback) Session(id string) (*core.PlaySession, bool)
- func (p *RemotePlayback) SessionFor(viewer int64, client string, k core.RatingKey) (*core.PlaySession, bool)
- func (p *RemotePlayback) SessionForSurface(surface string, viewer int64, client string, k core.RatingKey, release string, ...) (*core.PlaySession, bool)
- func (p *RemotePlayback) Sessions() []*core.PlaySession
- func (p *RemotePlayback) SetDraining(draining bool)
- func (p *RemotePlayback) SourceRetirement(id string) (core.SourceRetirement, bool)
- func (p *RemotePlayback) Stop(id string)
- func (p *RemotePlayback) Touch(id string)
- func (p *RemotePlayback) UnpinSourceRevision(id string)
- type RemotePlaybackOptions
- type ReopenRequest
- type ReopenResponsibility
- type ReopenedSource
- type ResponsibilityCounts
- type Route
- type Runtime
- func (r *Runtime) Allocated(id string) bool
- func (r *Runtime) Assignments(ctx context.Context) ([]Assignment, error)
- func (r *Runtime) BindDelivery(handler func(http.ResponseWriter, *http.Request, string)) error
- func (r *Runtime) BindLocalClientSession(ctx context.Context, id string, snapshot *core.PlaySession) error
- func (r *Runtime) BindMediaBrowserDelivery(handler http.Handler) error
- func (r *Runtime) BindNeutralControl(...) error
- func (r *Runtime) BindPlexDelivery(handler http.Handler) error
- func (r *Runtime) ClaimNeutralBinding(ctx context.Context, id, node string) error
- func (r *Runtime) Cleanup()
- func (r *Runtime) Close() error
- func (r *Runtime) CurrentCoordinator(ctx context.Context, id string) (Coordinator, error)
- func (r *Runtime) DecisionTranscoder() (core.Transcoder, error)
- func (r *Runtime) DeleteNeutralBinding(ctx context.Context, id string) error
- func (r *Runtime) DeletePlexBinding(ctx context.Context, id string) error
- func (r *Runtime) EncoderRetirement(id string) (core.EncoderRetirement, bool)
- func (r *Runtime) ForwardMedia(w http.ResponseWriter, q *http.Request, id, protocol string) bool
- func (r *Runtime) ForwardNeutralControl(ctx context.Context, a frontend.SessionAccess, id, operation string, ...) (string, bool, error)
- func (r *Runtime) ForwardPlexGrantMedia(w http.ResponseWriter, q *http.Request, id string) bool
- func (r *Runtime) ForwardPlexMedia(w http.ResponseWriter, q *http.Request, publicID string) bool
- func (r *Runtime) Handler() http.Handler
- func (r *Runtime) LoadNeutralBinding(ctx context.Context, id string) ([]byte, error)
- func (r *Runtime) LoadPlexBinding(ctx context.Context, id string) ([]byte, error)
- func (r *Runtime) LookupPreparationReceipt(ctx context.Context, owner nodewire.Identity, operation string) (PreparationReceipt, error)
- func (r *Runtime) LookupRetirementReceipt(ctx context.Context, f placement.Fence) (placement.RetirementReceipt, error)
- func (r *Runtime) MaintainCoordination(ctx context.Context) error
- func (r *Runtime) NeutralBindingIDs(ctx context.Context, protocol string, viewer int64, device string) ([]string, error)
- func (r *Runtime) NeutralMediaCurrent(ctx context.Context, id string) bool
- func (r *Runtime) NeutralSessionCurrent(ctx context.Context, id string) bool
- func (r *Runtime) NewPublicDelivery(authorizePlex func(context.Context, *http.Request, string) error) (http.Handler, error)
- func (r *Runtime) ObserveExecution(ctx context.Context, id string, maxAge time.Duration) (*remotetranscode.ObservedSession, error)
- func (r *Runtime) Pending(ctx context.Context) (int, error)
- func (r *Runtime) PendingDetails(ctx context.Context) (ResponsibilityCounts, error)
- func (r *Runtime) PrepareSource(ctx context.Context, owner nodewire.Identity, q PrepareRequest) (PreparedSource, error)
- func (r *Runtime) PreparedSourceRetired(ctx context.Context, owner nodewire.Identity, operation string) (bool, error)
- func (r *Runtime) Ready() bool
- func (r *Runtime) ReconcileExpired(ctx context.Context, id string) (core.EncoderRetirement, error)
- func (r *Runtime) RecoveryEvents(ctx context.Context, limit int) ([]RecoveryEvent, error)
- func (r *Runtime) ReleaseOutput(ctx context.Context, id string, fence placement.Fence) error
- func (r *Runtime) ReopenSource(ctx context.Context, old playbackcontinuity.SourceBinding, operation string) (ReopenedSource, error)
- func (r *Runtime) RetirePreparedSource(ctx context.Context, owner nodewire.Identity, operation string) (bool, error)
- func (r *Runtime) SaveNeutralBinding(ctx context.Context, id, protocol string, viewer int64, device string, ...) error
- func (r *Runtime) SavePlexBinding(ctx context.Context, id string, raw []byte) error
- func (r *Runtime) Session(id string) (core.HLSSession, bool)
- func (r *Runtime) SnapshotOutput(id string) (OutputBufferSnapshot, error)
- func (r *Runtime) StartDistributedHLS(ctx context.Context, viewer int64, playID, revision string, q core.HLSRequest) (core.HLSSession, error)
- func (r *Runtime) StartPreparedHLS(ctx context.Context, viewer int64, prepared PreparedSource, q core.HLSRequest) (core.HLSSession, error)
- func (r *Runtime) Stop(id string)
- func (r *Runtime) Supports(q core.HLSRequest) bool
- func (r *Runtime) Tick(ctx context.Context) error
- func (r *Runtime) VerifyReceipt(ctx context.Context, receipt placement.RetirementReceipt) error
- func (r *Runtime) VerifyReopen(ctx context.Context, old, next playbackcontinuity.SourceBinding, proof string) error
- type SelectionError
- type Verifier
Constants ¶
const CapabilitiesPath = "/cluster/playback/capabilities"
const DeliveryPath = "/cluster/playback/delivery"
const EvidencePath = "/cluster/playback/terminal-evidence"
const NeutralControlPath = "/cluster/playback/neutral-control"
const PlexDeliveryPath = "/cluster/playback/plex-media"
const PreparedBytesPath = "/cluster/playback/prepared-bytes"
const SourcePath = "/cluster/playback/source"
const TerminalPath = "/cluster/playback/terminal"
const WorkerPath = "/cluster/playback/worker"
Variables ¶
var ( ErrNoEligibleTarget = errors.New("clusterplayback: no eligible transcode target") )
var ErrDenied = errors.New("clusterplayback: denied")
var ErrPending = errors.New("clusterplayback: responsibility pending")
Functions ¶
func IsPublicRepresentation ¶
IsPublicRepresentation reports only the supported delivery route shape. It grants no access and says nothing about listener/readiness or backend support.
func Supports ¶
func Supports(q core.HLSRequest) bool
Supports is a side-effect-free admission gate. Unsupported requests must use the existing local backend before any distributed ownership is allocated.
Types ¶
type Assignment ¶
type Assignment struct {
Encoder string `json:"encoder,omitempty"`
ViewerID int64 `json:"-"`
Playback *PlaybackDisplay `json:"playback,omitempty"`
PlayID string `json:"playId,omitempty"`
SessionID string `json:"sessionId"`
SourceNodeID string `json:"sourceNodeId,omitempty"`
EncoderNodeID string `json:"encoderNodeId"`
ControllerNodeID string `json:"controllerNodeId"`
DeliveryNodeID string `json:"deliveryNodeId,omitempty"`
Generation int64 `json:"generation"`
}
type Coordinator ¶
Coordinator is the mutable control-plane owner. Epoch fences coordination; neither Epoch nor Identity changes the immutable execution fence/generation.
type Options ¶
type Options struct {
// AuthorRamp snapshots trusted configuration before the initial admission.
AuthorRamp func(core.HLSRequest) core.HLSRequest
MediaServers func(context.Context) ([]nodewire.Identity, error)
ProtocolSealer ProtocolSealer
// ClockReady continuously gates new and extended time-bounded authority.
ClockReady func() bool
Bus clusterbus.Bus
EncoderSegmentWait time.Duration
EncoderRPCDeadline time.Duration
EncoderFailureGrace time.Duration
// OutputBuffer supplies surviving-controller segment retention. Nil allocates
// a bounded lazy store used only by eligible reencoded-video HLS sessions.
OutputBuffer *playbackbuffer.Store
MaxSegmentBytes int64
WorkerCapabilities, RemoteCapabilities remotetranscode.Capabilities
// HistoryCapacity bounds boot-retained authority tombstones (default4096),
// independently of concurrent placement resource capacity.
HistoryCapacity int
// SourcePolicy rechecks live viewer/title/source rights from local facts.
SourcePolicy func(context.Context, *core.Viewer, *core.PlaySession) error
MemberRole func(context.Context, nodewire.Identity, config.NodeRole) error
// Eligible checks live exact boot membership, role, protocol and drain policy.
Eligible func(context.Context, nodewire.Identity, config.NodeRole) error
DB *sql.DB
Guard *nodewire.Guard
Self nodewire.Identity
Roles config.NodeRoles
Placement *placement.Service
Endpoint func(context.Context, nodewire.Identity) (string, error)
ActiveViewer func(context.Context, int64) (*core.Viewer, error)
Playback *playback.Manager
SourceAccess *playback.SourceAccess
Encoder core.OwnedTranscoder
Decide func(core.MediaInfo, core.ClientCaps, core.DecideOptions) core.Decision
Hardware core.HWAccel
Capacity int
ClockSkew time.Duration
ClockBoundKnown bool
}
type OutputBufferSnapshot ¶
type OutputBufferSnapshot struct {
Fence placement.Fence
Retaining bool
Reason string
Buffer playbackbuffer.Snapshot
}
OutputBufferSnapshot reports retained container observations. Fixed-grid recovery maps the immutable prefix to its original generations; observations do not prove viewer delivery, decoder continuity or permission to retire.
type PlaybackDisplay ¶
type PlaybackDisplay struct {
Protocol string `json:"protocol,omitempty"`
Decision core.DecisionKind `json:"decision,omitempty"`
VideoCopy bool `json:"videoCopy,omitempty"`
AudioCopy bool `json:"audioCopy,omitempty"`
Title string `json:"title,omitempty"`
TitleKey string `json:"titleKey,omitempty"`
Viewer string `json:"viewer,omitempty"`
Device string `json:"device,omitempty"`
App string `json:"app,omitempty"`
Video string `json:"video,omitempty"`
BitrateKbps int `json:"bitrateKbps,omitempty"`
}
PlaybackDisplay contains owner-facing facts only, never a transport credential.
type PreparationReceipt ¶
type PreparationReceipt struct {
Version uint8
Source, Controller nodewire.Identity
OperationHash, RequestHash [32]byte
LifetimeID string
Kind string // source-retired or no-source-barrier; never inferred from absence
PlayID, Revision string
Size int64
}
PreparationReceipt proves closure only of one source preparation operation. It is not placement, encoder, reopen or immutable-media equivalence evidence. Media fields contain actual captured facts when known; an error-owned lifetime can finish without ever returning media. Its exact opaque lifetime identity and immutable request hash remain bound to the terminal operation.
type PrepareRequest ¶
type PrepareRequest struct {
Operation string
Viewer int64
Key core.RatingKey
Caps core.ClientCaps
ReleaseID string
Exact bool
Protocol string
}
PrepareRequest contains authenticated frontend choices, never provider paths. Operation is immutable and boot scoped; uncertain retries use the same payload.
type PreparedSource ¶
type PreparedSource struct {
Owner nodewire.Identity
PlayID, Revision, ReleaseID string
Info core.MediaInfo
}
func (PreparedSource) MarshalJSON ¶
func (p PreparedSource) MarshalJSON() ([]byte, error)
func (*PreparedSource) UnmarshalJSON ¶
func (p *PreparedSource) UnmarshalJSON(raw []byte) error
type ProtocolSealer ¶
type ProtocolSealer interface {
Seal(string, []byte) (string, error)
Unseal(string, string) ([]byte, error)
}
ProtocolSealer uses the deployment's existing cluster credential key. Nil never permits plaintext fallback for a distributed protocol snapshot.
type RecoveryEvent ¶
type RecoveryEvent struct {
SessionID string `json:"sessionId"`
Role string `json:"role"`
FailedNodeID string `json:"failedNodeId"`
ReplacementNodeID string `json:"replacementNodeId,omitempty"`
Generation int64 `json:"generation"`
StartedAt time.Time `json:"startedAt"`
CompletedAt *time.Time `json:"completedAt,omitempty"`
Status string `json:"status"`
InterruptionMS *int64 `json:"interruptionMs,omitempty"`
ClientStalls *int `json:"clientStalls,omitempty"`
}
RecoveryEvent is an observation, never an authority or a retirement receipt. Nil impact measurements mean unknown, not zero client interruption.
type RecoveryEventReader ¶
type RecoveryEventReader interface {
RecoveryEvents(context.Context, int) ([]RecoveryEvent, error)
}
RecoveryEventReader lets the recovery coordinator supply bounded history.
type RemotePlayback ¶
type RemotePlayback struct {
// contains filtered or unexported fields
}
func NewRemotePlayback ¶
func NewRemotePlayback(r *Runtime, o RemotePlaybackOptions) (*RemotePlayback, error)
func (*RemotePlayback) BindClientSession ¶
func (p *RemotePlayback) BindClientSession(ctx context.Context, session, playID string) error
BindClientSession publishes only durable routing facts. No grant is persisted.
func (*RemotePlayback) CheckFileAvailability ¶
func (*RemotePlayback) CurrentSource ¶
func (p *RemotePlayback) CurrentSource(c context.Context, id string) (core.PlaybackSourceObservation, error)
func (*RemotePlayback) Estimate ¶
func (p *RemotePlayback) Estimate(c context.Context, t *core.Title, caps core.ClientCaps) core.MediaInfo
func (*RemotePlayback) Failover ¶
func (p *RemotePlayback) Failover(context.Context, string, time.Duration) (*core.PlaySession, error)
func (*RemotePlayback) InputURL ¶
func (p *RemotePlayback) InputURL(string) string
func (*RemotePlayback) MarkSurfaceOpened ¶
func (p *RemotePlayback) MarkSurfaceOpened(id string) bool
func (*RemotePlayback) MarkSurfacePrepared ¶
func (p *RemotePlayback) MarkSurfacePrepared(id string) bool
func (*RemotePlayback) OpenRemoteSource ¶
func (p *RemotePlayback) OpenRemoteSource(ctx context.Context, id string) error
OpenRemoteSource runs outside the broker mutex, before local visibility commit.
func (*RemotePlayback) PinSourceRevision ¶
func (p *RemotePlayback) PinSourceRevision(c context.Context, id, rev string) error
func (*RemotePlayback) PlaybackProgress ¶
func (*RemotePlayback) Prepare ¶
func (p *RemotePlayback) Prepare(c context.Context, v *core.User, k core.RatingKey, caps core.ClientCaps) (*core.PlaySession, error)
func (*RemotePlayback) PrepareSurface ¶
func (p *RemotePlayback) PrepareSurface(c context.Context, v *core.User, k core.RatingKey, caps core.ClientCaps, release string, exact bool) (*core.PlaySession, error)
func (*RemotePlayback) PrepareSurfaceSource ¶
func (p *RemotePlayback) PrepareSurfaceSource(c context.Context, v *core.User, k core.RatingKey, caps core.ClientCaps, release string, exact bool) (*core.PlaySession, core.SourceRetirement, error)
func (*RemotePlayback) RestoreNeutralSource ¶
func (p *RemotePlayback) RestoreNeutralSource(ctx context.Context, id string, snapshot core.PlaySession) error
func (*RemotePlayback) RestorePlexSource ¶
func (p *RemotePlayback) RestorePlexSource(ctx context.Context, id string, snapshot core.PlaySession) error
RestorePlexSource restores a read-only source snapshot for original protocol authorization. It creates no preparation, producer, source pin or ownership.
func (*RemotePlayback) RetireSource ¶
func (p *RemotePlayback) RetireSource(id string, life core.SourceRetirement) error
func (*RemotePlayback) RevalidateSession ¶
func (p *RemotePlayback) RevalidateSession(ctx context.Context, id string) error
func (*RemotePlayback) ServeRange ¶
func (p *RemotePlayback) ServeRange(w http.ResponseWriter, q *http.Request, id string)
func (*RemotePlayback) Session ¶
func (p *RemotePlayback) Session(id string) (*core.PlaySession, bool)
func (*RemotePlayback) SessionFor ¶
func (p *RemotePlayback) SessionFor(viewer int64, client string, k core.RatingKey) (*core.PlaySession, bool)
func (*RemotePlayback) SessionForSurface ¶
func (*RemotePlayback) Sessions ¶
func (p *RemotePlayback) Sessions() []*core.PlaySession
func (*RemotePlayback) SetDraining ¶
func (p *RemotePlayback) SetDraining(draining bool)
func (*RemotePlayback) SourceRetirement ¶
func (p *RemotePlayback) SourceRetirement(id string) (core.SourceRetirement, bool)
func (*RemotePlayback) Stop ¶
func (p *RemotePlayback) Stop(id string)
func (*RemotePlayback) Touch ¶
func (p *RemotePlayback) Touch(id string)
Touch and PlaybackProgress enqueue bounded state; Tick owns network work.
func (*RemotePlayback) UnpinSourceRevision ¶
func (p *RemotePlayback) UnpinSourceRevision(id string)
type RemotePlaybackOptions ¶
type RemotePlaybackOptions struct {
Estimate func(context.Context, *core.Title, core.ClientCaps) core.MediaInfo
SelectSource func(context.Context) (nodewire.Identity, error)
Capacity int
// IdleTimeout follows the source Manager idle policy (default two minutes).
IdleTimeout time.Duration
// Now is the lifecycle clock, primarily for deterministic tests.
Now func() time.Time
}
RemotePlayback is an explicit specialist broker backend. Full-server and Plex callers retain their existing local Manager and its optional interfaces.
type ReopenRequest ¶
type ReopenRequest struct {
Old playbackcontinuity.SourceBinding
Operation string
}
ReopenRequest is an immutable same-owner operation. It grants no encoder start or new placement authority. Operation remains owned even if the reply is lost.
type ReopenResponsibility ¶
type ReopenResponsibility struct {
// contains filtered or unexported fields
}
ReopenResponsibility remains owned on every uncertain or post-acquisition error. Retire schedules exact-operation cleanup on Runtime.Tick; no new Prepare occurs.
func (*ReopenResponsibility) Done ¶
func (l *ReopenResponsibility) Done() <-chan struct{}
func (*ReopenResponsibility) Err ¶
func (l *ReopenResponsibility) Err() error
func (*ReopenResponsibility) Retire ¶
func (l *ReopenResponsibility) Retire()
type ReopenedSource ¶
type ReopenedSource struct {
Owner nodewire.Identity
Operation string
Responsibility *ReopenResponsibility `json:"-"`
Prepared PreparedSource
Proof string
}
type ResponsibilityCounts ¶
type ResponsibilityCounts struct {
SourcePreparations, PreparationLifetimes, PreparationReceipts int
SourceLifetimes, SourceCallbacks int
EncoderStarts, EncoderTokens, Inputs int
RemotePreparing, RemoteLive, RemoteRetiring int
Executions, Reopens, Placements int
}
ResponsibilityCounts contains no session/operation credentials, private addresses or viewer identity. These are outstanding barriers, not a count of distinct playbacks. A placement and its encoder may appear independently.
func (ResponsibilityCounts) Total ¶
func (c ResponsibilityCounts) Total() int
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func NewRuntime ¶
func (*Runtime) Assignments ¶
func (r *Runtime) Assignments(ctx context.Context) ([]Assignment, error)
Assignments reads durable active routes. Delivery has no fixed owner, and route creation time is not a last-move observation. Both remain unknown. Coordination uses its mutable owner, never the immutable execution creator.
func (*Runtime) BindDelivery ¶
BindDelivery is called once by the broker constructor before listeners start. The callback retains all existing grant, viewer and current media checks.
func (*Runtime) BindLocalClientSession ¶
func (r *Runtime) BindLocalClientSession(ctx context.Context, id string, snapshot *core.PlaySession) error
BindLocalClientSession publishes the exact local source's owner before a full node returns a MediaBrowser session. It allocates no encoder or source lease. RemotePlayback publishes its source-owner route through BindClientSession.
func (*Runtime) BindMediaBrowserDelivery ¶
BindMediaBrowserDelivery replays the original mounted Jellyfin/Emby handlers, including their protocol policy and representation headers.
func (*Runtime) BindNeutralControl ¶
func (*Runtime) BindPlexDelivery ¶
BindPlexDelivery must receive the original authenticated public Plex handler, including existing token/grant/policy middleware, before listeners start.
func (*Runtime) ClaimNeutralBinding ¶
Claim only the existing public registry row; never create a new admission or elect over a newer session. The mutable coordinator epoch owns this transfer.
func (*Runtime) Cleanup ¶
func (r *Runtime) Cleanup()
Cleanup may block in backend Close. Never run it on the lease/control executor.
func (*Runtime) CurrentCoordinator ¶
CurrentCoordinator resolves the current control owner independently of the execution controller retained in Route.Fence. Callers must not infer encoder replacement or retirement from a coordination deadline.
func (*Runtime) DecisionTranscoder ¶
func (r *Runtime) DecisionTranscoder() (core.Transcoder, error)
DecisionTranscoder supplies server-only broker decisions without constructing providers, FFmpeg or a local encoder. DistributedHLS owns actual starts.
func (*Runtime) DeleteNeutralBinding ¶
func (*Runtime) DeletePlexBinding ¶
func (*Runtime) EncoderRetirement ¶
func (r *Runtime) EncoderRetirement(id string) (core.EncoderRetirement, bool)
func (*Runtime) ForwardMedia ¶
ForwardMedia performs at most one indexed ownership hop. No redirect or private endpoint is returned to a client. The owning broker authenticates the grant.
func (*Runtime) ForwardNeutralControl ¶
func (*Runtime) ForwardPlexGrantMedia ¶
ForwardPlexGrantMedia is deliberately distinct from account-token forwarding. It transports the exact original supported grant envelope; only the owner's original authentication and current-policy handlers authorize any bytes.
func (*Runtime) ForwardPlexMedia ¶
ForwardPlexMedia forwards only validated representation paths. The receiver runs the original Plex token/grant checks. No control/start endpoint is eligible.
func (*Runtime) LoadNeutralBinding ¶
func (*Runtime) LoadPlexBinding ¶
func (*Runtime) LookupPreparationReceipt ¶
func (r *Runtime) LookupPreparationReceipt(ctx context.Context, owner nodewire.Identity, operation string) (PreparationReceipt, error)
LookupPreparationReceipt reads only exact immutable trusted publication. Old source membership is intentionally not required: the source boot may have safely rolled after publication. The requesting controller is always Self.
func (*Runtime) LookupRetirementReceipt ¶
func (r *Runtime) LookupRetirementReceipt(ctx context.Context, f placement.Fence) (placement.RetirementReceipt, error)
LookupRetirementReceipt returns immutable exact historical proof in this configured cluster. It never grants execution or infers proof from a floor.
func (*Runtime) MaintainCoordination ¶
MaintainCoordination uses a SQL compare-and-swap. A paused old owner cannot renew after takeover. Expiry transfers only coordination, never execution. It performs only membership and SQL work. Call it independently of Tick: source RPCs, encoder probes and adoption must never delay lease renewal.
func (*Runtime) NeutralBindingIDs ¶
func (*Runtime) NeutralMediaCurrent ¶
Media replicas observe execution authority only. They never elect, renew, reserve, stop or manufacture ownership to read an already admitted encoder.
func (*Runtime) NeutralSessionCurrent ¶
func (*Runtime) NewPublicDelivery ¶
func (r *Runtime) NewPublicDelivery(authorizePlex func(context.Context, *http.Request, string) error) (http.Handler, error)
NewPublicDelivery constructs the delivery-only public representation sender. AuthorizePlex must perform the same live valid-token/receipt checks as the owning Plex frontend. Grant-only media uses the separate canonical envelope and owner authentication. Neutral grant authentication and current viewer/media policy run at owner.
func (*Runtime) ObserveExecution ¶
func (r *Runtime) ObserveExecution(ctx context.Context, id string, maxAge time.Duration) (*remotetranscode.ObservedSession, error)
ObserveExecution obtains a fresh detached exact-generation backend sample. RecoveryBuffer.DeliveredUntil and Goodput describe worker-to-controller output; neither proves final viewer delivery. Callers need independent delivery facts.
func (*Runtime) Pending ¶
Pending counts unresolved barriers, including expired reservations and joined source callback obligations. A read error is never quiescence.
func (*Runtime) PendingDetails ¶
func (r *Runtime) PendingDetails(ctx context.Context) (ResponsibilityCounts, error)
PendingDetails is a secret-free barrier inventory for drain diagnostics. Categories can describe the same playback; totals are not unique sessions. Errors or any outstanding category must keep drain blocked.
func (*Runtime) PrepareSource ¶
func (r *Runtime) PrepareSource(ctx context.Context, owner nodewire.Identity, q PrepareRequest) (PreparedSource, error)
func (*Runtime) PreparedSourceRetired ¶
func (*Runtime) ReconcileExpired ¶
ReconcileExpired admits only explicit exact-session terminal takeover. The returned token stays charged after transport loss. Expiry alone proves nothing.
func (*Runtime) RecoveryEvents ¶
func (*Runtime) ReleaseOutput ¶
ReleaseOutput is explicit final-session disposal, not rolling eviction. The caller must already have stopped public session publication. Exact durable retirement and no active readers are required; historical receipts alone do not authorize disposal of a later generation's bytes.
func (*Runtime) ReopenSource ¶
func (r *Runtime) ReopenSource(ctx context.Context, old playbackcontinuity.SourceBinding, operation string) (ReopenedSource, error)
func (*Runtime) RetirePreparedSource ¶
func (r *Runtime) RetirePreparedSource(ctx context.Context, owner nodewire.Identity, operation string) (bool, error)
RetirePreparedSource seals an exact frontend preparation even when no encoder reservation was made. A transport error retains responsibility at the caller.
func (*Runtime) SaveNeutralBinding ¶
func (*Runtime) SavePlexBinding ¶
SavePlexBinding retains opaque protocol-owned credentials only in the shared database. It never exports them to membership, events, logs or historical admission records. Only the live coordinator may publish this generation.
func (*Runtime) SnapshotOutput ¶
func (r *Runtime) SnapshotOutput(id string) (OutputBufferSnapshot, error)
func (*Runtime) StartDistributedHLS ¶
func (r *Runtime) StartDistributedHLS(ctx context.Context, viewer int64, playID, revision string, q core.HLSRequest) (core.HLSSession, error)
StartDistributedHLS starts from the exact source already prepared by the authenticated broker. ErrUnsupported is returned exclusively before side effects.
func (*Runtime) StartPreparedHLS ¶
func (r *Runtime) StartPreparedHLS(ctx context.Context, viewer int64, prepared PreparedSource, q core.HLSRequest) (core.HLSSession, error)
StartPreparedHLS composes a concrete remote source-owner preparation with the same durable encoder placement. The broker's remote planning seam can use it.
func (*Runtime) Supports ¶
func (r *Runtime) Supports(q core.HLSRequest) bool
Supports answers for the request StartPreparedHLS will actually admit. A frontend submits the bounded-copy request before the copy grid is authored, so judging the raw request rejects every valid bounded copy.
func (*Runtime) Tick ¶
Tick owns only bounded control work; Cleanup runs separately. A lost renewal response is reconciled through worker accepted history, never source replay.
func (*Runtime) VerifyReceipt ¶
VerifyReceipt authenticates fresh independent worker/input and source proof. Digests are compared only after authenticated exact-peer observations.
func (*Runtime) VerifyReopen ¶
func (r *Runtime) VerifyReopen(ctx context.Context, old, next playbackcontinuity.SourceBinding, proof string) error
VerifyReopen is the concrete same-owner SourceReopenVerifier provider. It rechecks current new-fence authority and exact source policy on every call. Cross-host/boot revision equivalence is deliberately unsupported.
type SelectionError ¶
type SelectionError struct {
}
SelectionError describes only pre-reservation observations. It contains no node addresses, source facts, request fields or underlying transport errors. Exhausted counts advisory pool reads, never retirement or release evidence.
func (*SelectionError) Error ¶
func (e *SelectionError) Error() string
func (*SelectionError) Unwrap ¶
func (e *SelectionError) Unwrap() error
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Verifier is constructed before placement.New and bound once after NewRuntime. An unbound verifier denies retirement. There is no timeout-based release.
func NewVerifier ¶
func NewVerifier() *Verifier
Source Files
¶
- admission_store.go
- assignments.go
- attach.go
- boot_retirement.go
- capabilities.go
- console.go
- controlled_session.go
- coordination.go
- coordinator.go
- decision.go
- delivery.go
- encoder_recovery.go
- evidence.go
- fence_notifications.go
- file_availability.go
- initial_admission.go
- local_delivery.go
- media_replica.go
- media_wire.go
- neutral_control.go
- neutral_state.go
- observation.go
- operation_gate.go
- output_buffer.go
- plex_delivery.go
- plex_grant_delivery.go
- preparation_receipts.go
- preparation_takeover.go
- prepare.go
- prepared_bytes.go
- protocol_state.go
- provenance.go
- public_delivery.go
- receipt.go
- recovery_decision.go
- recovery_delivery.go
- recovery_events.go
- remote_playback.go
- reopen.go
- reopen_lifetime.go
- responsibilities.go
- runtime.go
- selection.go
- source.go
- source_activity.go
- source_failover.go
- source_tracking.go
- store.go
- terminal.go
- terminal_coordination.go
- worker.go