console

package
v1.4.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 14 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

Index

Constants

View Source
const ChannelSize = 2048

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConsoleDeviceService added in v1.3.0

type AppConsoleDeviceService interface {
	GetDevice(ctx context.Context, orgId uuid.UUID, name string) (*domain.Device, domain.Status)
	UpdateDevice(ctx context.Context, orgId uuid.UUID, name string, device domain.Device, fieldsToUnset []string) (*domain.Device, error)
}

AppConsoleDeviceService is the narrow interface AppConsoleSessionManager needs, avoiding a full service.Service dependency in flightctl-remote-access.

type AppConsoleSession added in v1.3.0

type AppConsoleSession struct {
	UUID       string
	OrgId      uuid.UUID
	DeviceName string
	AppName    string
	SendCh     chan []byte
	RecvCh     chan []byte
	ProtocolCh chan string
	// ErrCh carries a session-level failure reported by the agent (e.g. the requested
	// application does not exist). The WebSocket handler must close the client
	// connection with a distinguishable close code/reason instead of relaying this as
	// console payload data.
	ErrCh chan SessionFailure
}

AppConsoleSession is the server-side session object bridging the WebSocket handler and the gRPC stream from the agent.

type AppConsoleSessionManager added in v1.3.0

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

AppConsoleSessionManager manages application console sessions using device annotations. It mirrors ConsoleSessionManager, keyed on DeviceAnnotationRemoteSession with per-(appName, consoleType) uniqueness enforcement (stored as a JSON array of DeviceRemoteSession). A serial and a vnc session may be active on the same app at once; only two sessions of the same consoleType for the same app conflict.

func (*AppConsoleSessionManager) CloseSession added in v1.3.0

func (m *AppConsoleSessionManager) CloseSession(ctx context.Context, session *AppConsoleSession) domain.Status

CloseSession removes the annotation entry and unregisters the session. Annotation cleanup runs first so that a DB failure does not leave the session removed from pendingStreams while the device annotation still advertises it.

func (*AppConsoleSessionManager) StartSession added in v1.3.0

func (m *AppConsoleSessionManager) StartSession(ctx context.Context, orgId uuid.UUID, deviceName, appName, consoleType string, force bool) (*AppConsoleSession, domain.Status)

StartSession validates inputs, guards against duplicates via annotation, and registers the session. When force is true and a session already exists for (appName, consoleType), that session's annotation entry is atomically replaced (see replaceAppSession) instead of returning a 409 conflict; the agent is responsible for noticing the takeover and tearing down the replaced session itself. A session of a different consoleType for the same app is unaffected either way.

type AppConsoleSessionRegistration added in v1.3.0

type AppConsoleSessionRegistration interface {
	StartSession(session *AppConsoleSession) error
	CloseSession(session *AppConsoleSession) error
}

AppConsoleSessionRegistration is implemented by the gRPC server that the agent connects to.

type ConsoleEventNotifier added in v1.3.0

type ConsoleEventNotifier interface {
	NotifyConsole(ctx context.Context, orgId uuid.UUID, name string) error
	ClearConsoleNotification(ctx context.Context, orgId uuid.UUID, name string) error
}

ConsoleEventNotifier signals the device agent that a console session needs handling. It is deliberately decoupled from rendered-spec versioning.

type ConsoleSession

type ConsoleSession struct {
	UUID       string
	OrgId      uuid.UUID
	DeviceName string
	SendCh     chan []byte
	RecvCh     chan []byte
	ProtocolCh chan string
}

type ConsoleSessionManager

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

func NewConsoleSessionManager

func NewConsoleSessionManager(deviceSvc deviceservice.Service, log logrus.FieldLogger, sessionRegistration InternalSessionRegistration, notifier ConsoleEventNotifier) *ConsoleSessionManager

func (*ConsoleSessionManager) CloseSession

func (m *ConsoleSessionManager) CloseSession(ctx context.Context, session *ConsoleSession) domain.Status

func (*ConsoleSessionManager) StartSession

func (m *ConsoleSessionManager) StartSession(ctx context.Context, orgId uuid.UUID, deviceName, sessionMetadata string) (*ConsoleSession, domain.Status)

type InternalSessionRegistration

type InternalSessionRegistration interface {
	// Register a session with a given UUID and channels
	// Those channels will be used to read from and write to the session
	// in a way that this interface down to the gRPC session is abstracted
	StartSession(*ConsoleSession) error
	CloseSession(*ConsoleSession) error
}

type SessionFailure added in v1.3.0

type SessionFailure struct {
	// Code is an optional machine-readable code (e.g. consts.AppConsoleErrorCodeNotReady).
	// Empty for generic failures.
	Code string
	// Message is the human-readable failure detail.
	Message string
}

SessionFailure is a session-level failure reported by the agent.

Jump to

Keyboard shortcuts

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