Struct ComponentSchemaSpec
- Namespace
- Typhon.Schema.Definition
- Assembly
- Typhon.Schema.Definition.dll
Pure-data description of one component revision's schema: its identity, storage/durability defaults, and ordered fields. Consumed by the engine's single build core (shared by reflection and the source generator) to produce the compiled component definition.
public readonly struct ComponentSchemaSpec
- Inherited Members
Constructors
ComponentSchemaSpec(string, int, ComponentFieldSpec[], StorageMode, CommitDiscipline, bool)
Creates a component schema spec.
public ComponentSchemaSpec(string name, int revision, ComponentFieldSpec[] fields, StorageMode storageMode = StorageMode.Versioned, CommitDiscipline defaultDiscipline = CommitDiscipline.TickFence, bool managedOffsets = false)
Parameters
namestringComponent name (see Name).
revisionintSchema revision (see Revision).
fieldsComponentFieldSpec[]Ordered field specs (see Fields).
storageModeStorageModeStorage mode (see StorageMode); default Versioned.
defaultDisciplineCommitDisciplineDefault commit discipline (see DefaultDiscipline); default TickFence.
managedOffsetsboolWhether the field offsets describe the managed layout (see ManagedOffsets). Defaults to
falsedeliberately: a caller that has not measured them must not be taken to have done so.
Properties
DefaultDiscipline
Default commit discipline (from DefaultDiscipline); only meaningful for SingleVersion.
public CommitDiscipline DefaultDiscipline { get; }
Property Value
Fields
The component's fields in declaration order (parent-first for inherited layouts). Never null.
public ComponentFieldSpec[] Fields { get; }
Property Value
ManagedOffsets
Whether Offset was measured against the MANAGED layout — the one the engine reads components through.
public bool ManagedOffsets { get; }
Property Value
Remarks
The source generator measures each field with Unsafe.ByteOffset against a stack probe and sets this. Runtime reflection has only a
Type to work from, so it reads Marshal.OffsetOf — the MARSHALLED layout — and leaves it clear. The two layouts agree for ordinary
blittable primitives and diverge for bool (1 byte managed, 4 marshalled) and char (2 vs 1), which is why the distinction is recorded
rather than assumed: a definition built from unmeasured offsets must not silently carry them into storage (#819).
Name
Component name — the stable schema identity (from Name).
public string Name { get; }
Property Value
Revision
Component schema revision (from Revision).
public int Revision { get; }
Property Value
StorageMode
Storage mode for this component (from StorageMode).
public StorageMode StorageMode { get; }