Skip to main content
Version: 0.16.0

The Session

Everything a unit does after admission happens inside one Session, a single bidirectional stream between the unit and the Core. Commands and questions arrive on it; acknowledgements, answers, health reports and events leave on it. A stream's data is the one thing that never travels on it. The Core judges whether a Session is still valid and may end it on its own authority, while the unit can only leave. When the Session ends, the incarnation that held it ends too. This page gives the Session's life, its identity, the envelope every message carries, and the order in which a message is checked.

FromToWhen
admittedopenthe first envelope is a session OPEN carrying the identity admission issued
admitted—the unit dies before connecting; this stays distinguishable from a refusal
openclosedsession CLOSE, sent by the unit: a departure
openrevokedsession REVOKED, sent by the Core: an eviction
openlostthe transport fails
lostrevokedthe heartbeat terms are exceeded

Identity​

  • The Core generates the Session identity. A unit never proposes one.
  • It is used once. A Session that has ended cannot be reopened; recovery is a new admission.
  • An incarnation holds at most one Session, because its token is single-use.
  • The Session identity is a secret and is not guessable; the incarnation is a counter for a person reading a log. Both are kept.

Validity​

Validity is a condition a Session keeps satisfying, and the Core judges it.

It persists while
health reports arrive within the assigned terms
behaviour stays within the granted scope
nothing has revoked it
  • A unit cannot assess its own Session. It observes consequences: a revocation, a closed stream, a refused message.
  • A working connection is not evidence of validity. A unit can be connected and reporting into a Session that was already revoked.
  • Traffic on an invalid Session is never processed as ordinary traffic.

Opening and closing​

  • The first envelope must be a session OPEN carrying the identity admission issued. Anything else closes the stream.
  • An identity that was never issued, is already used, or belongs to an ended Session resolves to nothing, and the stream closes.
  • CLOSE is the unit's and REVOKED is the Core's. Both end a Session and they are always told apart.
  • Losing the stream is not closing it. The Core acts when the heartbeat terms are exceeded. A unit that intends to stop should send CLOSE.

Revocation​

The Core ends a Session on its own authority.

CauseWhat the unit can do next
liveness lostbe relaunched and admitted again
plugin disablednothing: it is refused at the gate while disabled
scope exceedednothing: it is a defect to report
protocol failurenothing: further exchange was uninterpretable
  • REVOKED names its cause and carries a line for a person. CLOSE carries nothing.
  • A message outside the unit's scope is refused on its own, and the Session goes on. Revoking for a scope exceeded is for traffic a refusal cannot answer one message at a time: data on a stream nobody granted. The Core creates a stream's transport only for a granted stream and attributes what arrives by the transport, so such traffic has nowhere to arrive and no Session is revoked for that cause. The cause stays on the wire.
  • Revocation is not a restart. Whether the process is relaunched is the supervisor's decision, taken when the process exits.
  • A revocation by decision leaves the unit Refused; one for lost liveness leaves it Failed.

The heartbeat terms​

Set by the Core at admission and returned in the registration answer; never chosen by the unit.

TermDefault
the interval10s
the tolerance3 missed intervals

The Core acts after the tolerance is exceeded, not on the first miss.

The envelope​

Every message of the Session, in both directions, carries four fields and exactly one payload.

FieldPresentHolds
message identityalwaysrefers to this message; a repeat within a Session is refused
Session identityalwayswhat attributes the message
sender's clockalwayswhen it was sent, for a person reading a trail
correlation identitywhere it answers another messagewhich message it answers
  • The plugin, unit and incarnation are resolved from the Session, never restated on a message.
  • The timestamp is never a validity check and never orders processing.
  • Absent by design: a family field (the payload is the family), a protocol version (fixed at admission), a sequence number (the stream is ordered), a credential (the Session identity is the proof).
  • Never zero payloads and never two.

Correlation​

A message that responds is correlated; a message that reports is not.

FamilyCorrelated
ack, query answeralways
errorwhen the failure is attributable to a message
data, health, event, sessionnever
  • A correlation refers only within its own Session.
  • A correlation is never the message's own identity.
  • An acknowledgement with no correlation is refused. It is never matched by guessing.

Validation, in order​

A receiver checks in this sequence and stops at the first failure.

#Check
1structural: the message decodes, and no field exceeds its bound
2Session resolution
3validity
4uniqueness of the message identity
5direction: a family arriving from the side that may not send it is refused, whatever it contains
6correlation, where the family requires it
7semantics
Where the SessionThe failure
can carry a responseis answered with an error, correlated to the offending message where one can be identified
cannot be resolvedis dropped and recorded on the Core's side

A well-formed message can still be meaningless — data for a stream never granted, an acknowledgement for a command never issued. Structure and meaning are checked apart.