Table of Contents

Struct Transaction.IndexEntityEnumerator<T, TKey>

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

MVCC-correct streaming enumerator over the per-archetype index B+Trees backing one component. Use CurrentComponent for zero-copy ref access into page memory, or Current for a convenience copy. Supports both unique and AllowMultiple indexes.

public ref struct Transaction.IndexEntityEnumerator<T, TKey> where T : unmanaged where TKey : unmanaged

Type Parameters

T
TKey
Inherited Members

Properties

Current

Convenience accessor — copies the component into a tuple. Prefer CurrentComponent for zero-copy.

public (long EntityPK, TKey Key, T Component) Current { get; }

Property Value

(long EntityPK, TKey Key, T Component)

CurrentComponent

Zero-copy ref into the epoch-protected page memory. Valid until the next MoveNext() call.

public ref readonly T CurrentComponent { get; }

Property Value

T

CurrentEntityPK

The primary key of the current entity.

public long CurrentEntityPK { get; }

Property Value

long

CurrentKey

The index key of the current entry.

public TKey CurrentKey { get; }

Property Value

TKey

Methods

Dispose()

Releases the per-archetype and component accessors (unpins accessed pages). Idempotent.

public void Dispose()

GetEnumerator()

Returns this enumerator (enables the foreach pattern).

public Transaction.IndexEntityEnumerator<T, TKey> GetEnumerator()

Returns

Transaction.IndexEntityEnumerator<T, TKey>

MoveNext()

Advances to the next index entry visible at this transaction's snapshot (skipping entries hidden by MVCC), positioning Current / CurrentComponent. Returns false when the range is exhausted.

public bool MoveNext()

Returns

bool

Remarks

Two resolutions, chosen by how the component is stored in THIS archetype. A SingleVersion slot's bytes are the cluster slot itself, so the span points straight into the SoA. A Versioned slot's cluster bytes are only the HEAD; a transaction reading at an older TSN must go through the chain, so the entity's record supplies the chain root and RevisionChainReader.WalkChain picks the visible revision. Reading the SoA for a Versioned slot would return the newest value to every snapshot — visible only as a subtly wrong read, never as an error.