Documentation
¶
Overview ¶
Package controller advances machines. It reads its inbox and its wakes in the store, takes one step at a time for each instance with something waiting, and writes down the result. Everything it does is a write to the store.
Index ¶
Constants ¶
const ( DefaultRuns = 100 MostRuns = 1000 )
DefaultRuns is how many runs a job's ls gives by default, and MostRuns the most its limit asks for.
const ( StepTime = 10 * time.Second StepMemory = 1 << 30 )
The limits of a step's process. A step of a small machine takes about 15 ms and 25 MiB.
const MaxMessage = 256 << 10
MaxMessage is the largest a message may be.
const StepArg = "step"
StepArg, after the argument that makes the binary run one job, makes it read one step.
Variables ¶
var ( // ListRuns gives the runs a client reads at a prefix or under it, the // newest first and at most limit of them. ListRuns func(ctx context.Context, s store.Store, ctl *identity.Identity, as, at string, limit int) (any, error) // ShowRun gives one run as a client is shown it, and with record its // record too, as JSON of at most max bytes. refused is why that client // is shown no such run, or that its record is larger. ShowRun func(ctx context.Context, s store.Store, ctl *identity.Identity, as, id string, record bool, max int) (run any, entries []byte, refused, err error) )
Reads is how the controller shows runs to a job: as the client package shows them to a client. That package sets both, since it uses this one.
Functions ¶
Types ¶
type Controller ¶
type Controller struct {
ID *identity.Identity
Store store.Store
// Now is the controller's clock.
Now func() time.Time
// SideBySide bounds how many store requests a pass has open at once,
// however much is owed.
SideBySide int
// AnyRunner has a job carried out whatever tags it names, as under
// corbie test.
AnyRunner bool
// Command starts the process of a step taken in a process of its own;
// by default, this binary.
Command []string
// StepTime is how long that process may run.
StepTime time.Duration
}
A Controller brings nothing with it but its key. Who it trusts, its trees, the secrets and values set at locations, and every instance are in the store.
func New ¶
func New(id *identity.Identity, s store.Store) *Controller
New makes a controller on a store.
func (*Controller) Idle ¶ added in v0.46.0
func (c *Controller) Idle(ctx context.Context) (bool, error)
Idle says whether a pass has nothing to do but housekeeping: no message is in the inbox, and every wake set is housekeeping's. Asked between two passes, it says that nothing but a message from another party can move an instance.
func (*Controller) Pass ¶
Pass looks at the store, does everything that is owed, and stops. It says when the next thing is due, if it knows of one.
func (*Controller) Timed ¶ added in v0.46.0
func (c *Controller) Timed(ctx context.Context) (bool, error)
Timed says whether a pass has nothing to do until the clock moves on: no message is in the inbox, and every wake set is housekeeping's, or a timer's, a run's timeout or the timeout of a call that waits for its answer, and not yet due. Asked between two passes, it says that no job runs and nothing but the clock or a message from another party can move an instance.
type Location ¶ added in v0.48.0
A Location is what a tree's entry keeps of one of its locations: the hash of the file recorded there, and its lifetime.
type Recorded ¶ added in v0.48.0
A Recorded is the file recorded at a location: where its definition is stored, and its hash.