Documentation
¶
Index ¶
Constants ¶
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 uniqueness enforcement (stored as a JSON array of DeviceRemoteSession).
func NewAppConsoleSessionManager ¶ added in v1.3.0
func NewAppConsoleSessionManager( svc AppConsoleDeviceService, log logrus.FieldLogger, reg AppConsoleSessionRegistration, notifier ConsoleEventNotifier, ) *AppConsoleSessionManager
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, 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.
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 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
}