Documentation
¶
Overview ¶
Package control is the control socket of aicoded dev: JSON over HTTP/1.1 on a Unix socket in the workspace's private state folder, through which aicoded mcp and a second aicoded dev reach the running one.
Index ¶
- Constants
- func AlreadyRunning(st devapi.Status) error
- func Listen(ctx context.Context, path string) (net.Listener, error)
- func Serve(ctx context.Context, l net.Listener, b devapi.Backend) error
- func SocketPath(state string) string
- type Client
- func (c *Client) Logs(ctx context.Context, q devapi.LogQuery) ([]devapi.LogEntry, error)
- func (c *Client) Mail(ctx context.Context, app string) ([]devapi.MailSummary, error)
- func (c *Client) MailGet(ctx context.Context, app, id string) (devapi.Mail, error)
- func (c *Client) MailReceive(ctx context.Context, app string, m devapi.InboundMail) (string, error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) Restart(ctx context.Context, app string) (devapi.App, error)
- func (c *Client) Status(ctx context.Context) (devapi.Status, error)
- func (c *Client) Trace(ctx context.Context, id string) (devapi.Trace, error)
- func (c *Client) Traces(ctx context.Context, q devapi.TraceQuery) ([]devapi.TraceSummary, error)
- func (c *Client) WhatBroke(ctx context.Context, app string) (devapi.Broken, error)
Constants ¶
const Protocol = "1"
Protocol is the version of the control protocol. Every request and answer carries it in the Aicoded-Control header.
Variables ¶
This section is empty.
Functions ¶
func AlreadyRunning ¶
AlreadyRunning is the E-DEV-012 error for the aicoded dev whose status is st.
func Listen ¶
Listen serves the control socket at path. It fails with E-DEV-012 when an aicoded dev answers there, or something listens there without answering within 2 s, and with E-DEV-013 when an aicoded dev of another version answers. It removes a socket that nothing listens on, refuses any other file at path with E-DEV-016 and a path too long for a socket with E-DEV-017, and gives the socket mode 0600.
func Serve ¶
Serve answers the requests that reach l from b until ctx is done, then waits up to 5 s for the requests in flight.
func SocketPath ¶
SocketPath returns the path of the control socket in the state folder state.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client reaches an aicoded dev through its control socket.
func (*Client) MailReceive ¶
func (*Client) Ping ¶
Ping asks for the status and fails with E-DEV-013 when the aicoded dev there speaks another protocol.
func (*Client) Traces ¶
func (c *Client) Traces(ctx context.Context, q devapi.TraceQuery) ([]devapi.TraceSummary, error)