Documentation
¶
Overview ¶
Package connector is the Go client of the harness HTTP API, for every connector that runs in Go: the CLI and the TUI ship in the device binary and call the harness only through it.
Index ¶
- func Login(ctx context.Context, token string) (c Client, old Client, version string, err error)
- func Path() (string, error)
- type Client
- func (c Client) Call(ctx context.Context, method, path, ctype string, body io.Reader, out any) error
- func (c Client) Create(ctx context.Context, cr harness.Create, via string) (string, error)
- func (c Client) Do(ctx context.Context, method, path, ctype string, body io.Reader) (*http.Response, error)
- func (c *Client) Find(ctx context.Context) error
- func (c Client) Info(ctx context.Context, id string) (harness.Info, error)
- func (c Client) Post(ctx context.Context, id, via, text string, files []string) (int, error)
- func (c Client) Records(ctx context.Context, id string, after int, wait string) ([]statefile.Record, error)
- func (c Client) Save() error
- func (c Client) Sessions(ctx context.Context, status string, limit int) ([]harness.Info, error)
- func (c Client) SetWorkers(ctx context.Context, id, via string, ws []statefile.Worker) error
- func (c Client) Stop(ctx context.Context, id, via string) error
- func (c Client) Version(ctx context.Context) (string, error)
- func (c Client) Workers(ctx context.Context) ([]Worker, error)
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
URL string `json:"url"`
Key string `json:"key"`
Harness string `json:"harness"`
Mesh string `json:"-"`
}
Client is what login wrote: the harness's key, the URL it was last found at, and the api key's secret. On a worker of that harness, calls go to its node on the mesh, at Mesh.
func Load ¶
Load is what login wrote, with the harness on the mesh when the worker on this machine follows the same harness key, else proved at its URL, or found again through the pointer and saved.
func (Client) Call ¶
func (c Client) Call(ctx context.Context, method, path, ctype string, body io.Reader, out any) error
Call does one request, and decodes a JSON reply into out when out is given.
func (Client) Do ¶
func (c Client) Do(ctx context.Context, method, path, ctype string, body io.Reader) (*http.Response, error)
Do does one request; a status outside 2xx is an error in the harness's own words.
func (*Client) Find ¶
Find proves the harness at its URL, or finds it again through the pointer and saves it.
func (Client) Post ¶
Post appends text and files as one turn: a single text/plain body, or one multipart part per piece, each typed by its extension. A file with no type is refused, not guessed. Returns the last record's n.
func (Client) Records ¶
func (c Client) Records(ctx context.Context, id string, after int, wait string) ([]statefile.Record, error)
Records is the file after record n; with wait, a long poll.
func (Client) SetWorkers ¶
SetWorkers makes ws the session's workers from its next step on.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package tui is the Mainplane terminal app: a retained tree of components on the term engine, and its screens: login, and the session.
|
Package tui is the Mainplane terminal app: a retained tree of components on the term engine, and its screens: login, and the session. |
|
term
Package term owns the terminal for a full screen app: raw mode and the alternate screen with a guaranteed restore, capability queries, input decoding, a cell buffer and a diff renderer.
|
Package term owns the terminal for a full screen app: raw mode and the alternate screen with a guaranteed restore, capability queries, input decoding, a cell buffer and a diff renderer. |