display

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package display coordinates the single interactive VM display across API replicas. Media never enters this package.

Index

Constants

View Source
const (
	// ClientTTL is how long a claim stays valid without a renewal, measured on
	// each participant's own monotonic clock from when it sent the request.
	ClientTTL = 4 * time.Second
	// FenceInterval is how long a contender must observe an unchanged
	// resourceVersion before it may take over a held lease. It exceeds the
	// worst case in which a partitioned owner could still be writing input:
	// its renewals fail, and its local input deadline passes, within ClientTTL
	// of losing API contact — long before FenceInterval elapses.
	FenceInterval = 12 * time.Second
)

Variables

View Source
var ErrBusy = errors.New("interactive display in use")
View Source
var ErrRevoked = errors.New("interactive display ownership revoked")

Functions

This section is empty.

Types

type Guard

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

Guard bounds validity using request-start times on this process's monotonic clock. A delayed renewal must not resurrect an expired owner.

func Acquire

func Acquire(ctx context.Context, store *Store, ns, name string) (*Guard, error)

func (*Guard) Close

func (g *Guard) Close()

Close must be invoked after the caller has closed its media sockets.

func (*Guard) Deadline

func (g *Guard) Deadline() (time.Time, bool)

func (*Guard) Done

func (g *Guard) Done() <-chan struct{}

type Store

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

func NewStore

func NewStore(client kubernetes.Interface) *Store

func (*Store) Claim

func (s *Store) Claim(ctx context.Context, ns, name, tier string) (string, error)

func (*Store) InUse

func (s *Store) InUse(ctx context.Context, ns, name string) (bool, error)

func (*Store) Release

func (s *Store) Release(ctx context.Context, ns, name, id string) error

Release is called only after media sockets/workers have stopped. A stale token can never release a successor. Tokens must not be logged or sent to guests.

func (*Store) Renew

func (s *Store) Renew(ctx context.Context, ns, name, id string) error

func (*Store) Revoke

func (s *Store) Revoke(ctx context.Context, ns, name string) (bool, error)

Revoke marks the current owner revoked without freeing its slot. The old proxy/API must stop input before Release, or the full fence interval elapses.

func (*Store) ServeHTTP

func (s *Store) ServeHTTP(w http.ResponseWriter, r *http.Request, ns, name, action string)

ServeHTTP requires the enclosing route to authorize editor/namespace access and resolve the VM. Claim IDs are workspace-scoped, high-entropy capabilities in a header, never a URL/query string or a credential sent to the guest.

Jump to

Keyboard shortcuts

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