Documentation
¶
Overview ¶
Package mgmt defines the control-socket protocol between the cliwrap management CLI and a running Manager.
Index ¶
- Constants
- type Client
- type EventsStreamPayload
- type EventsSubscribePayload
- type ListEntry
- type ListResponsePayload
- type LogsRequestPayload
- type LogsStreamPayload
- type ManagerAPI
- type Server
- type ServerOptions
- type StartRequestPayload
- type StatusRequestPayload
- type StatusResponsePayload
- type StopRequestPayload
Constants ¶
const ( MsgListRequest ipc.MsgType = 0xA0 MsgListResponse ipc.MsgType = 0xA1 MsgStatusRequest ipc.MsgType = 0xA2 MsgStatusResponse ipc.MsgType = 0xA3 MsgLogsRequest ipc.MsgType = 0xA4 MsgLogsStream ipc.MsgType = 0xA5 MsgEventsSubscribe ipc.MsgType = 0xA6 MsgEventsStream ipc.MsgType = 0xA7 MsgStartRequest ipc.MsgType = 0xA8 MsgStopRequest ipc.MsgType = 0xA9 )
Management-specific message types. They reuse the ipc framing layer but use distinct numeric IDs in the 0xA0..0xAF range.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a synchronous client for the management socket. It is not safe for concurrent use - callers should open one per goroutine.
type EventsStreamPayload ¶
type EventsStreamPayload struct {
ProcessID string `msgpack:"pid"`
Type string `msgpack:"t"`
Timestamp int64 `msgpack:"ts"`
Summary string `msgpack:"sum"`
}
EventsStreamPayload carries a serialized event summary.
type EventsSubscribePayload ¶
type EventsSubscribePayload struct{}
EventsSubscribePayload has no fields yet; included for future filters.
type ListEntry ¶
type ListEntry struct {
ID string `msgpack:"id"`
Name string `msgpack:"name"`
State string `msgpack:"state"`
ChildPID int `msgpack:"pid"`
RSS uint64 `msgpack:"rss"`
}
ListEntry is one row in a list response.
type ListResponsePayload ¶
type ListResponsePayload struct {
Entries []ListEntry `msgpack:"entries"`
}
ListResponsePayload is returned for MsgListResponse.
type LogsRequestPayload ¶
LogsRequestPayload asks for the ring-buffer snapshot of a process.
type LogsStreamPayload ¶
type LogsStreamPayload struct {
ID string `msgpack:"id"`
Stream uint8 `msgpack:"s"`
Data []byte `msgpack:"d"`
EOF bool `msgpack:"eof"`
}
LogsStreamPayload carries a single chunk of streamed log bytes.
type ManagerAPI ¶
type ManagerAPI interface {
List() []ListEntry
StatusOf(id string) (ListEntry, error)
Stop(ctx context.Context, id string) error
}
ManagerAPI is the subset of Manager functionality the server exposes. Using an interface keeps tests decoupled from the concrete Manager.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server listens on a Unix domain socket and handles management requests.
func NewServer ¶
func NewServer(opts ServerOptions) (*Server, error)
NewServer returns a Server; call Start to begin accepting connections.
type ServerOptions ¶
type ServerOptions struct {
SocketPath string
Manager ManagerAPI
SpillerDir string
}
ServerOptions configures the management server.
type StartRequestPayload ¶
type StartRequestPayload struct {
ID string `msgpack:"id"`
}
StartRequestPayload requests that a registered process be started.
type StatusRequestPayload ¶
type StatusRequestPayload struct {
ID string `msgpack:"id"`
}
StatusRequestPayload asks for a specific process's status.
type StatusResponsePayload ¶
StatusResponsePayload summarizes one process.
type StopRequestPayload ¶
type StopRequestPayload struct {
ID string `msgpack:"id"`
}
StopRequestPayload requests that a running process be stopped.