Class SessionEvents
The tick's session lifecycle: everything that happened to sessions since the last tick, as one batch.
public sealed class SessionEvents
- Inheritance
-
SessionEvents
- Inherited Members
Remarks
Written from anywhere, read only by the tick. Admission runs on a transport thread and closing runs on the tick, so production is many-to-one and takes a lock — once per connection and once per disconnection, which is nowhere near any hot path. Consumption is a bare span walk with no synchronization at all, because the buffer an application reads is not the buffer producers are appending to.
Two buffers, swapped once per tick. That is what makes "delivered in the tick they happened" true without holding a lock across application code: Typhon.Engine.SessionEvents.BeginTick takes what accumulated and hands it over whole. An event produced while the tick is running lands in the other buffer and is delivered next tick — never dropped, never delivered twice.
Steady state allocates nothing. Both buffers keep their high-water capacity and are reused; the only allocations are the growth steps of the first ticks that reach a new peak.
Properties
Count
How many events this tick carries.
public int Count { get; }
Property Value
PendingCount
Events waiting for the next tick. Diagnostics only — an application reads AsSpan().
public int PendingCount { get; }
Property Value
Methods
AsSpan()
This tick's events, in the order they were produced.
public ReadOnlySpan<SessionEvent> AsSpan()
Returns
- ReadOnlySpan<SessionEvent>
The batch. It is valid until the next tick begins.
GetEnumerator()
Walks this tick's events.
public ReadOnlySpan<SessionEvent>.Enumerator GetEnumerator()
Returns
- ReadOnlySpan<SessionEvent>.Enumerator
An enumerator over AsSpan().