Skip to content

Decide what creating and stopping the core means, including a host that suspends it #115

Description

@iderex

The concurrency record in #9 answers what happens when the host process wants the
core's threads stopped. Nothing on this board builds that, and it is not the kind
of thing that gets added later, because by then every client has invented its own
version of it and the versions differ.

A phone suspends an application in the middle of a request and resumes it an hour
later on a different network. A television kills the process outright with a
queue half drained. A desktop keeps it running for a week across a suspend to
disk, which is the case where a clock that appears to have moved forward by
thirty seconds has actually moved forward by three days. All three are ordinary
and none of them is a crash.

What this produces

Creation as one act that takes every implementation the core wants from a client:
the storage in #40, the secret store in #33, the diagnostics sink in #100. What
happens when one of them is absent is already answered in each of those issues,
so this one states only that the absence is legal and that a capability a client
can ask about says which of them are present.

A stop that is true when it returns. Every request cancelled, every decode
stopped, no thread the core started still running, and nothing left half written
that #105 then has to reason about.

Suspend and resume as their own pair, distinct from stop, because a resume keeps
what a stop discards. What a resume may not assume is the part worth writing
down: not that the token is still valid, not that the network is the same one,
and not that the elapsed time is what the device's own clock makes it look like,
which is #102's question and is answered there rather than again here.

What a stop owes work that was never delivered. That is the durable queue in #47
and not a second mechanism built here, because two mechanisms for the same
promise means one of them is the one that gets tested.

Done when

A test creates the core with no client implementations supplied at all and proves
it works within the reduced capability each of those issues already states. A
test starts a set of requests, stops the core, and proves every one of them ended
in a cancellation or a named error, that no thread outlived the stop, and that
the stop returned only after both were true. A test suspends and resumes across a
clock jump and proves the core neither trusts the old token nor treats the jump
as elapsed time. Blocked on #9, #27, #33, #40 and #100.

Metadata

Metadata

Assignees

Labels

architectureShape of the core: boundaries, interfaces, contracts

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions