Table of Contents

Class DBComponentDefinition

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

Compiled description of a single component revision: its name, schema revision, storage layout, fields, and index metadata. Built once from a [Component]-annotated struct (via CreateFromAccessor<T>()) and thereafter immutable.

public class DBComponentDefinition
Inheritance
DBComponentDefinition
Inherited Members

Properties

ComponentStorageOverhead

Bytes of per-chunk overhead stored alongside the field data: the inline entityPK (EntityPKOverheadSize) plus one back-reference slot per multi-valued index (MultipleIndicesCount times sizeof(int)).

public int ComponentStorageOverhead { get; }

Property Value

int

ComponentStorageSize

Byte size of the component's field data (the largest field offset plus its size), excluding per-chunk overhead.

public int ComponentStorageSize { get; }

Property Value

int

ComponentStorageTotalSize

Total per-chunk stride: ComponentStorageSize plus ComponentStorageOverhead.

public int ComponentStorageTotalSize { get; }

Property Value

int

DefaultDiscipline

Default durability discipline (from [Component(DefaultDiscipline=…)]). Only meaningful for SingleVersion; TickFence otherwise.

public DurabilityDiscipline DefaultDiscipline { get; }

Property Value

DurabilityDiscipline

EntityPKOverheadSize

Size of the inline entityPK in the chunk overhead (8 bytes for all SV/Transient components, 0 for Versioned). Non-versioned components store the entityPK at chunk offset 0 to enable chunkId → entityPK resolution.

public int EntityPKOverheadSize { get; }

Property Value

int

FieldsByName

All fields of this component keyed by field name, including static (non-stored) fields.

public IReadOnlyDictionary<string, DBComponentDefinition.Field> FieldsByName { get; }

Property Value

IReadOnlyDictionary<string, DBComponentDefinition.Field>

FullName

Unique key combining Name and Revision, formatted as {Name}:R{Revision}.

public string FullName { get; }

Property Value

string

IndicesCount

Number of indexed fields on this component (fields carrying [Index]).

public int IndicesCount { get; }

Property Value

int

this[int]

The field with the given FieldId. Valid indices are 0 to MaxFieldId minus one.

public DBComponentDefinition.Field this[int index] { get; }

Parameters

index int

Property Value

DBComponentDefinition.Field

MaxFieldId

One past the highest non-static FieldId; equals the length of the FieldId-indexed array backing this[int].

public int MaxFieldId { get; }

Property Value

int

MultipleIndicesCount

Number of indexed fields whose index allows multiple entities per key (non-unique); each reserves a back-reference slot in the overhead.

public int MultipleIndicesCount { get; }

Property Value

int

Name

Component name — from Name, or the struct type name when unset.

public string Name { get; }

Property Value

string

POCOType

The unmanaged struct type this definition was built from, or the registered POCO type. May be null until set by the builder.

public Type POCOType { get; }

Property Value

Type

Revision

Schema revision of this definition, from Revision. Distinct revisions of the same name coexist.

public int Revision { get; }

Property Value

int

SpatialField

Reference to the field with [SpatialIndex], or null if none.

public DBComponentDefinition.Field SpatialField { get; }

Property Value

DBComponentDefinition.Field

StorageMode

How this component's data is stored, persisted, and recovered. See StorageMode.

public StorageMode StorageMode { get; }

Property Value

StorageMode

Methods

CreateField(int, string, FieldType, FieldType, int, Type)

Creates a field, registers it under name, and returns it.

public DBComponentDefinition.Field CreateField(int fieldId, string name, FieldType type, FieldType underlyingType, int offset, Type dotNetType)

Parameters

fieldId int

Unique field identifier within the component.

name string

Field name; must be unique within the component.

type FieldType

Field type as stored on the component.

underlyingType FieldType

Element type when type is a collection; otherwise None.

offset int

Byte offset of the field within the component's storage.

dotNetType Type

The backing CLR type of the field.

Returns

DBComponentDefinition.Field

The newly created DBComponentDefinition.Field.

Exceptions

ArgumentException

A field with the same name already exists on the component.

GetFieldId(string)

Returns the FieldId of the field with the given name, or -1 if no such field exists.

public int GetFieldId(string fieldName)

Parameters

fieldName string

Returns

int