Documentation
¶
Index ¶
- type Client
- func (c *Client) AgentStatus(ctx context.Context) ([]*protopkg.AgentStatus, error)
- func (c *Client) Close() error
- func (c *Client) GetLogs(ctx context.Context, agentID string) (<-chan string, error)
- func (c *Client) Lifecycle(ctx context.Context, agentIDs []string, ...) []Result
- func (c *Client) LifecycleWithOpts(ctx context.Context, agentIDs []string, ...) []Result
- func (c *Client) Ping(ctx context.Context) (string, error)
- func (c *Client) ReloadAgents(ctx context.Context) error
- func (c *Client) Shutdown(ctx context.Context, action string) error
- func (c *Client) Start(ctx context.Context, agentIDs []string) []Result
- func (c *Client) StartWithOpts(ctx context.Context, agentIDs []string, opts LifecycleOptions) []Result
- func (c *Client) Stop(ctx context.Context, agentIDs []string) []Result
- type LifecycleOptions
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a programmatic interface to interact with a running GAPI daemon.
func NewFromBus ¶
NewFromBus creates a new Client using an existing EventBus (for in-process use).
The returned Client does NOT own the bus: Close is a no-op on it, and the caller that built the bus remains responsible for shutting it down.
func (*Client) AgentStatus ¶
AgentStatus queries the daemon for the status of all agents.
func (*Client) Close ¶
Close releases the daemon connection this Client dialled.
WITHOUT IT EVERY INVOCATION LEFT A DEAD PEER IN THE DAEMON FOR A FULL MINUTE (GAPI-DIV-124). A gapictl process exited without a graceful QUIC close, so the daemon learned of it only when MaxIdleTimeout expired - config.QUICIdleTimeout, 60 seconds - at which point handleConn's AcceptStream returned and the deferred delete removed the peer. The daemon therefore carried every control invocation of the last minute in its peer set, and fanned every reply out to all of them.
Idempotent, because callers defer it and some paths also close explicitly: EventBus.Close guards on its own closed flag.
func (*Client) GetLogs ¶
GetLogs subscribes to the logs for a specific agent and returns a channel of log lines. The subscription is automatically cleaned up when the context is cancelled.
func (*Client) Lifecycle ¶
func (c *Client) Lifecycle(ctx context.Context, agentIDs []string, action protopkg.LifecycleControl_Action) []Result
Lifecycle sends a lifecycle action to a set of agents and waits for their transition.
func (*Client) LifecycleWithOpts ¶
func (c *Client) LifecycleWithOpts(ctx context.Context, agentIDs []string, action protopkg.LifecycleControl_Action, opts LifecycleOptions) []Result
LifecycleWithOpts sends a lifecycle action with options.
func (*Client) ReloadAgents ¶
ReloadAgents triggers a reload of the agent registry on the daemon.
func (*Client) Shutdown ¶
Shutdown requests a system shutdown from the daemon. action is one of "poweroff", "reboot", "halt" (the topic's documented payload vocabulary); in PID-1 mode the daemon answers with the full init teardown.
func (*Client) StartWithOpts ¶
func (c *Client) StartWithOpts(ctx context.Context, agentIDs []string, opts LifecycleOptions) []Result
StartWithOpts triggers the START action with options.
type LifecycleOptions ¶
LifecycleOptions defines optional parameters for lifecycle actions.