Skip to main content

Module state

Module state 

Source
Expand description

The session lifecycle: five states, six events, and the table between them.

§Why the table is explicit

Every edge is written out. A conditional inside a match arm would be shorter and would let the legal set drift away from the documented one, which is exactly the failure a lifecycle has to be able to rule out. Written out, the set of states is the set of match arms and the set of edges is the set of arms, so a reader can check one against the other by eye.

§Why Closed is terminal

A session that could re-open would leak every in-flight request it was holding, and the specification has no transition back. Session::apply answers LifecycleError::Terminal from Closed for every event rather than silently treating the session as freshly uninitialised.

Structs§

Instant
A monotonic reading from an injected clock.
Session
A session and the phase it is in.
SessionId
A session’s identity.

Enums§

LifecycleError
Why a lifecycle transition was refused.
LifecycleEvent
Something that happened to a session.
SessionState
Where a session is in its lifecycle.