Table of Contents

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

name string

Component name (see Name).

revision int

Schema revision (see Revision).

fields ComponentFieldSpec[]

Ordered field specs (see Fields).

storageMode StorageMode

Storage mode (see StorageMode); default Versioned.

defaultDiscipline CommitDiscipline

Default commit discipline (see DefaultDiscipline); default TickFence.

managedOffsets bool

Whether the field offsets describe the managed layout (see ManagedOffsets). Defaults to false deliberately: 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

CommitDiscipline

Fields

The component's fields in declaration order (parent-first for inherited layouts). Never null.

public ComponentFieldSpec[] Fields { get; }

Property Value

ComponentFieldSpec[]

ManagedOffsets

Whether Offset was measured against the MANAGED layout — the one the engine reads components through.

public bool ManagedOffsets { get; }

Property Value

bool

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

string

Revision

Component schema revision (from Revision).

public int Revision { get; }

Property Value

int

StorageMode

Storage mode for this component (from StorageMode).

public StorageMode StorageMode { get; }

Property Value

StorageMode