Table of Contents

Interface ISessionRequests

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

The session lifecycle as an application system sees it: the tick's session events, and the requests it makes of a session in answer — the part of SubscriptionsCommands an application's lifecycle code needs, behind an interface so that code can be unit-tested.

public interface ISessionRequests

Remarks

A test seam, not a second path. Write the lifecycle handling (Opened: spawn and Control(EntityId); Closed and resumable: hold the body; Opened with ResumedFrom: rebind; ResumeExpired: retire) against this interface, pass ctx.Subscriptions in the tick and a RecordingSessionRequests in a test. The events arrive and the requests are recorded exactly as in a running engine; nothing is applied, which is the engine's part and has its own tests.

A system that steers sessions on its hot path keeps calling SubscriptionsCommands directly: the session lifecycle is a handful of events a tick, where an interface call costs nothing measurable.

Properties

SessionEvents

What happened to sessions since the last tick, in order (SessionEvents).

ReadOnlySpan<SessionEvent> SessionEvents { get; }

Property Value

ReadOnlySpan<SessionEvent>

Methods

ControlledOf(SessionId)

The entity a session controls, or Null (ControlledOf(SessionId)).

EntityId ControlledOf(SessionId session)

Parameters

session SessionId

The session.

Returns

EntityId

The controlled entity.

Session(SessionId)

Asks something of a session; applied by the next tick's prologue (Session(SessionId)).

SessionRequest Session(SessionId session)

Parameters

session SessionId

The session.

Returns

SessionRequest

A builder whose calls are recorded.