console

package
v1.3.0-rc1 Latest Latest
Warning

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

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

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 string
}

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
}

Jump to

Keyboard shortcuts

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