Struct EntityRecordHeader
Header of an entity record stored in the per-archetype LinearHash. 14 bytes: BornTSN (6B) + DiedTSN (6B) + EnabledBits (2B). Component locations (4B × N) follow immediately after in raw byte storage.
public struct EntityRecordHeader
- Inherited Members
Remarks
TSN packing follows the same pattern as CompRevStorageElement: upper 32 bits + lower 16 bits = 48-bit TSN.
Non-aligned 6-byte fields are safe because the per-bucket OLC latch serializes writers and detects torn reads.
Fields
BornTsnHigh
Upper 32 bits of the 48-bit BornTSN; combine with BornTsnLow via BornTSN.
public uint BornTsnHigh
Field Value
BornTsnLow
Lower 16 bits of the 48-bit BornTSN; combine with BornTsnHigh via BornTSN.
public ushort BornTsnLow
Field Value
DiedTsnHigh
Upper 32 bits of the 48-bit DiedTSN; combine with DiedTsnLow via DiedTSN. 0 = alive.
public uint DiedTsnHigh
Field Value
DiedTsnLow
Lower 16 bits of the 48-bit DiedTSN; combine with DiedTsnHigh via DiedTSN. 0 = alive.
public ushort DiedTsnLow
Field Value
EnabledBits
Per-component enable mask: bit N set means component slot N is enabled.
public ushort EnabledBits
Field Value
Properties
BornTSN
48-bit BornTSN packed as upper 32 + lower 16.
public long BornTSN { readonly get; set; }
Property Value
DiedTSN
48-bit DiedTSN packed as upper 32 + lower 16.
public long DiedTSN { readonly get; set; }
Property Value
IsAlive
True if the entity has not been destroyed (DiedTSN == 0).
public readonly bool IsAlive { get; }
Property Value
Methods
IsVisibleAt(long)
Check whether this entity is visible to a transaction with the given TSN.
public readonly bool IsVisibleAt(long txTsn)
Parameters
txTsnlong
Returns
Remarks
Visibility rules (snapshot isolation):
- BornTSN == 0: genesis entity, always visible
- BornTSN != 0 and BornTSN > txTsn: not born yet → invisible
- DiedTSN == 0: alive → visible (if born)
- DiedTSN != 0 and DiedTSN <= txTsn: dead at this snapshot → invisible