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 ( 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 ¶
This section is empty.
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.