Documentation
¶
Overview ¶
Package sprintwire is how a worker talks to the sprint's server: the run loop on the coordinator's machine, the one writer of the sprint, which runs a worker's verbs for it, one at a time, beside the store. The server is single threaded and runs each request's batch in order, a plain client/server pair carries the verbs rather than a shared store, and both ends are Go. A request is the worker's verbs, each the argument list it would give nova-sprint, in the order to run them; the reply is each verb's exit code and what it printed. One request is one exchange whatever it carries, from beside the server or from 100 ms away.
Index ¶
Constants ¶
const ( MaxRequest = 1 << 20 MaxVerbs = 256 )
MaxRequest bounds a request's body, and MaxVerbs the verbs of one batch.
const Path = "/verbs"
Path is the server's one endpoint.
const Timeout = 2 * time.Minute
Timeout is how long a client waits for the server's answer by default.
const Tries = 3
Tries is how many times a verb is sent when the server does not answer. A write carries one operation id through them, so one that ran and whose answer was lost returns its recorded result and changes nothing twice.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Addr string // host:port
HTTP *http.Client // nil is a client that waits Timeout for an answer
}
Client sends verbs to a sprint server.
type Request ¶
type Request struct {
Verbs [][]string `json:"verbs"`
}
Request is a worker's verbs, in the order to run them.
type Response ¶
type Response struct {
Results []Result `json:"results"`
}
Response is the answers, one a verb, in the request's order.
type Result ¶
type Result struct {
Code int `json:"code"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
}
Result is one verb's answer: nova-sprint's exit code, and what it printed.
type Worker ¶
type Worker struct {
// Send delivers verbs to the server in one request: Client.Do in
// production, the server's own step in a test (no connection).
Send func(ctx context.Context, verbs ...[]string) ([]Result, error)
// Failed shapes what a verb that did not exit 0 printed, for the member's
// log; nil is its stderr, then its stdout.
Failed func(stdout, stderr []byte) []byte
// Budget bounds one verb, its tries together; 0 is Timeout.
Budget time.Duration
// contains filtered or unexported fields
}
Worker runs a worker's sprint verbs on the sprint's server: each verb's arguments are sent and its exit code and what it printed come back, as when the worker ran nova-sprint itself, so a member is the same loop over either. The worker's machine reads and writes nothing of the store.