Documentation
¶
Overview ¶
Package pluginhost supervises local Control package processes. Package requests enter only after the kernel has completed admission and routing.
Index ¶
- Variables
- func SetDefaultManager(manager Manager)
- type ArtifactRef
- type DispatchInput
- type DispatchOutput
- type DrainResult
- type Header
- type HostHealth
- type Manager
- type ManagerConfig
- type MigrationCheckpointRecorder
- type MigrationInput
- type MigrationManager
- type MigrationOutput
- type RequestMetadata
- type Supervisor
- func (m *Supervisor) Close() error
- func (m *Supervisor) Dispatch(ctx context.Context, input DispatchInput) (DispatchOutput, error)
- func (m *Supervisor) Drain(ctx context.Context, packageID, version string, generation uint64, ...) error
- func (m *Supervisor) Health(ctx context.Context, packageID, version string, generation uint64) (HostHealth, error)
- func (m *Supervisor) Migrate(ctx context.Context, input MigrationInput, ...) (MigrationOutput, error)
- func (m *Supervisor) OpenWebSocket(ctx context.Context, input WebSocketInput) (*WebSocketRelay, error)
- func (m *Supervisor) Rollback(ctx context.Context, packageID, version string, generation uint64) error
- func (m *Supervisor) Shutdown(ctx context.Context) error
- func (m *Supervisor) Start(ctx context.Context, ref ArtifactRef, generation uint64) error
- func (m *Supervisor) Stop(ctx context.Context, packageID, version string, generation uint64) error
- type WebSocketClose
- type WebSocketFrame
- type WebSocketInput
- type WebSocketManager
- type WebSocketRelay
Constants ¶
This section is empty.
Variables ¶
var ( ErrHostNotFound = errors.New("plugin host not found") ErrHostIncompatible = errors.New("plugin host incompatible") )
Functions ¶
func SetDefaultManager ¶
func SetDefaultManager(manager Manager)
SetDefaultManager installs the process-wide supervisor used by HTTP route handlers. A nil value deliberately leaves route dispatch fail-closed.
Types ¶
type ArtifactRef ¶
type ArtifactRef struct {
PackageID string
Version string
ArtifactPath string
ArtifactSHA256 string
EntrypointPath string
EntrypointSHA256 string
ManifestPath string
ManifestSHA256 string
}
ArtifactRef describes files materialized by a caller that has already bound them to a signed package release. The manager verifies every supplied digest again immediately before starting the entrypoint.
type DispatchInput ¶
type DispatchOutput ¶
type DrainResult ¶
type HostHealth ¶
type Manager ¶
type Manager interface {
Start(context.Context, ArtifactRef, uint64) error
Dispatch(context.Context, DispatchInput) (DispatchOutput, error)
Health(context.Context, string, string, uint64) (HostHealth, error)
Drain(context.Context, string, string, uint64, time.Time) error
Stop(context.Context, string, string, uint64) error
Rollback(context.Context, string, string, uint64) error
}
func DefaultManager ¶
func DefaultManager() Manager
type ManagerConfig ¶
type ManagerConfig struct {
RuntimeDir string
StartupTimeout time.Duration
BridgeFactory packagebridge.SessionFactory
}
type MigrationCheckpointRecorder ¶
type MigrationCheckpointRecorder func(context.Context, MigrationOutput) error
MigrationCheckpointRecorder must durably persist each host reply before the migration caller can observe it. A nil recorder is rejected fail-closed.
type MigrationInput ¶
type MigrationInput struct {
PackageID string
Version string
MigrationID string
Checkpoint string
Generation uint64
// BridgeCapability is minted only by Supervisor and is never caller-owned.
BridgeCapability []byte
Deadline time.Time
}
MigrationInput is passed through to the verified package host. Checkpoint and migration identifier values are package-owned opaque strings.
type MigrationManager ¶
type MigrationManager interface {
Migrate(context.Context, MigrationInput, MigrationCheckpointRecorder) (MigrationOutput, error)
}
MigrationManager is intentionally separate from Manager so existing route dispatch consumers do not gain a migration capability by accident.
type MigrationOutput ¶
type MigrationOutput struct {
Checkpoint string
ValidationDigest string
Complete bool
FailureCode string
HealthLeaseID string
HealthGeneration uint64
}
MigrationOutput is the opaque reply returned by a package host. The kernel only persists and fences these values; it does not interpret their domain meaning.
type RequestMetadata ¶
type RequestMetadata struct {
Path string `json:"path,omitempty"`
Query map[string][]string `json:"query,omitempty"`
Headers map[string][]string `json:"headers,omitempty"`
PathParams map[string]string `json:"path_params,omitempty"`
ClientIP string `json:"client_ip,omitempty"`
UserAgent string `json:"user_agent,omitempty"`
NodeID uint `json:"node_id,omitempty"`
TrustedAgentWebSocketAuth bool `json:"trusted_agent_websocket_auth,omitempty"`
TrustedAgentWebSocketForwardNode bool `json:"trusted_agent_websocket_forward_node,omitempty"`
}
RequestMetadata preserves the request address independently from the package route identifier. Query values remain multi-valued because v2 clients may repeat a key.
type Supervisor ¶
type Supervisor struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(config ManagerConfig) (*Supervisor, error)
func (*Supervisor) Close ¶
func (m *Supervisor) Close() error
Close retires every host and releases the pinned runtime-root descriptor.
func (*Supervisor) Dispatch ¶
func (m *Supervisor) Dispatch(ctx context.Context, input DispatchInput) (DispatchOutput, error)
func (*Supervisor) Health ¶
func (m *Supervisor) Health(ctx context.Context, packageID, version string, generation uint64) (HostHealth, error)
func (*Supervisor) Migrate ¶
func (m *Supervisor) Migrate(ctx context.Context, input MigrationInput, recorder MigrationCheckpointRecorder) (MigrationOutput, error)
Migrate forwards one resumable migration step to the active host, persists its reply through recorder, and treats a completed response as activation only after the host health lease still matches the requested generation.
func (*Supervisor) OpenWebSocket ¶
func (m *Supervisor) OpenWebSocket(ctx context.Context, input WebSocketInput) (*WebSocketRelay, error)
func (*Supervisor) Start ¶
func (m *Supervisor) Start(ctx context.Context, ref ArtifactRef, generation uint64) error
type WebSocketClose ¶
type WebSocketFrame ¶
type WebSocketFrame struct {
Data []byte
Close *WebSocketClose
}
WebSocketFrame is a post-open relay frame. A nil Close represents a data frame, including an empty opaque payload.
type WebSocketInput ¶
type WebSocketManager ¶
type WebSocketManager interface {
OpenWebSocket(context.Context, WebSocketInput) (*WebSocketRelay, error)
}
WebSocketManager is separate from unary route dispatch so callers must consciously opt into the bidirectional package-host transport.
type WebSocketRelay ¶
type WebSocketRelay struct {
// contains filtered or unexported fields
}
WebSocketRelay owns one verified package-host stream. Callers may make one Send and one Recv call concurrently; concurrent writes are serialized.
func (*WebSocketRelay) Close ¶
func (r *WebSocketRelay) Close(close WebSocketClose) error
func (*WebSocketRelay) Recv ¶
func (r *WebSocketRelay) Recv() (WebSocketFrame, error)
func (*WebSocketRelay) Send ¶
func (r *WebSocketRelay) Send(frame WebSocketFrame) error