Table of Contents

Interface IChronicler

Namespace
Chronicler
Assembly
Chronicler.dll

Defines a recording pass for values, owned state, and stable links.

public interface IChronicler

Properties

Context

Gets the session context for the current chronicler pass.

ChronicleContext Context { get; }

Property Value

ChronicleContext

The context that supplies stable link registrations and tracks deferred assignments for this pass.

Mode

Gets the direction of the current pass.

SerializationMode Mode { get; }

Property Value

SerializationMode

Saving reads the schema's current state. Loading applies the recorded state.

Methods

LookDeepStruct<T>(ref T, string)

Records an owned struct inline.

void LookDeepStruct<T>(ref T value, string name) where T : struct, IRecordable

Parameters

value T

The value to write on save. A present record loads into a fresh value. For missing or null input, the pass runs the schema against an empty record before replacing this value.

name string

The stable field name shared by saving and loading.

Type Parameters

T

The type of the owned value.

Remarks

If a present record throws while applying its schema, the new value can be partly updated. If applying an empty record throws, the prior value is retained.

LookDeep<T>(ref T, string)

Records an owned class instance.

void LookDeep<T>(ref T value, string name) where T : class, IRecordable

Parameters

value T

The existing instance to write or populate. A missing or null entry leaves the target untouched.

name string

The stable field name shared by saving and loading.

Type Parameters

T

The declared type of the owned object.

Remarks

A present entry runs the schema on the existing target instance. A failure can leave that instance partly updated.

Exceptions

InvalidOperationException

A present entry needs an instance, but the load target is null.

Processes a named link by stable ID.

void LookLink<T>(ref T value, string name, string? slot = null, RecordLinkResolveMode resolveMode = RecordLinkResolveMode.Immediate, Action<T>? assignLoadedValue = null)

Parameters

value T

The value to identify on save. On load, receives the resolved value, or the default of T for a missing, null, or queued entry. An unresolved immediate link leaves this value unchanged.

name string

The stable field name to use on both save and load.

slot string

An optional identity domain. Null or empty selects the default slot.

resolveMode RecordLinkResolveMode

Whether a present ID must resolve when read. Defaults to immediate resolution.

assignLoadedValue Action<T>

Optional load callback for immediate links. Required when reading a present ID in deferred mode. Receives the resolved value or the default for a missing or null entry.

Type Parameters

T

The declared type used for registry lookup.

Use the callback to assign state when a queued link resolves, because the pass cannot update value after the call returns. See ResolveDeferredLinks().

Exceptions

InvalidOperationException

A non-null value has no stable ID on save, a present immediate link cannot resolve, or a present deferred link is read without an assignment callback.

LookNullableDeep<T>(ref T?, string)

Records an optional owned struct inline.

void LookNullableDeep<T>(ref T? value, string name) where T : struct, IRecordable

Parameters

value T?

The value to write on save. A missing or null entry clears it on load. A present record is staged before assignment.

name string

The stable field name shared by saving and loading.

Type Parameters

T

The underlying non-nullable struct type.

Remarks

An absent value is omitted on save. A failure while loading a present record leaves the existing nullable value in place.

LookValue<T>(ref T, string, T?)

Records a leaf value.

void LookValue<T>(ref T value, string name, T? defaultValue = default)

Parameters

value T

The value to write on save. On load, receives the decoded value or the declared default for a missing or null entry.

name string

The stable field name shared by saving and loading.

defaultValue T

The schema default. The built-in transports omit null values and values equal to this default when saving.

Type Parameters

T

The type handled by the active transport.

Remarks

Leaf encoding is transport-specific. Record hashes include the current and default values for supported leaf types.