Table of Contents

Class AssetRegistry

Namespace
Shard.Assets.Typed
Assembly
Shard.Assets.dll

Owns typed asset definitions and advances every registered store through one load-time pipeline. Feature modules contribute stores during setup; all callbacks are discarded after preparation or failure.

public sealed class AssetRegistry
Inheritance
AssetRegistry
Inherited Members

Properties

IsFaulted

public bool IsFaulted { get; }

Property Value

bool

IsPrepared

public bool IsPrepared { get; }

Property Value

bool

IsResolved

public bool IsResolved { get; }

Property Value

bool

RegisteredTypes

public ImmutableArray<AssetTypeInfo> RegisteredTypes { get; }

Property Value

ImmutableArray<AssetTypeInfo>

TagIndices

The shared tag index populated during resolution and referenced by asset packets.

public IReadOnlyDictionary<string, int> TagIndices { get; }

Property Value

IReadOnlyDictionary<string, int>

TotalAssets

public int TotalAssets { get; }

Property Value

int

Warnings

Gets the attributed diagnostics that did not fail preparation and were published with the asset snapshot.

public IReadOnlyList<AssetWarning> Warnings { get; }

Property Value

IReadOnlyList<AssetWarning>

Remarks

The list remains empty until IsPrepared is true.

WarningsTruncated

Reports whether one or more codec operations omitted or shortened warning diagnostics.

public bool WarningsTruncated { get; }

Property Value

bool

Methods

GetDependency<T>(AssetTypeDefinition<T>)

Reads an immutable dependency candidate from a typed lifecycle callback before final publication.

public AssetMap<T> GetDependency<T>(AssetTypeDefinition<T> definition) where T : notnull

Parameters

definition AssetTypeDefinition<T>

Returns

AssetMap<T>

Type Parameters

T

GetDependency<T>(AssetDefinitionBinding<T>)

Reads an immutable dependency candidate for an asset definition bound to a host.

public AssetMap<T> GetDependency<T>(AssetDefinitionBinding<T> binding) where T : notnull

Parameters

binding AssetDefinitionBinding<T>

Returns

AssetMap<T>

Type Parameters

T

GetOrCreateTagIndex(string)

Creates or returns a tag index during Resolve; every other pipeline phase is read-only.

public int GetOrCreateTagIndex(string tag)

Parameters

tag string

Returns

int

GetTagIndex(string)

Gets an index established during Resolve without mutating the shared tag table.

public int GetTagIndex(string tag)

Parameters

tag string

Returns

int

Get<T>(AssetTypeDefinition<T>)

Returns the frozen lookup snapshot published for an asset definition after preparation completes.

public AssetMap<T> Get<T>(AssetTypeDefinition<T> definition) where T : notnull

Parameters

definition AssetTypeDefinition<T>

Returns

AssetMap<T>

Type Parameters

T

Get<T>(AssetDefinitionBinding<T>)

Returns the frozen lookup snapshot published for an asset definition bound to a host.

public AssetMap<T> Get<T>(AssetDefinitionBinding<T> binding) where T : notnull

Parameters

binding AssetDefinitionBinding<T>

Returns

AssetMap<T>

Type Parameters

T

IndexIn(string, string?)

Resolve an asset name to its index in another store (0 = EMPTY when absent).

public int IndexIn(string storeType, string? assetName)

Parameters

storeType string
assetName string

Returns

int

Load(string)

public void Load(string serverRoot)

Parameters

serverRoot string

Load(string, IAssetSource)

public void Load(string serverRoot, IAssetSource assetSource)

Parameters

serverRoot string
assetSource IAssetSource

Materialize()

public void Materialize()

Prepare()

Builds contributed setup packets and permanently releases every callback target.

public IReadOnlyList<IToClientPacket> Prepare()

Returns

IReadOnlyList<IToClientPacket>

Register(string, IReadOnlyList<AssetStoreRegistration>)

Registers exactly one atomic store batch for a diagnostic module owner before loading starts. The owner identifies failures; it is not a caller-authentication boundary.

public void Register(string ownerModuleId, IReadOnlyList<AssetStoreRegistration> registrations)

Parameters

ownerModuleId string
registrations IReadOnlyList<AssetStoreRegistration>

Resolve()

Runs contributed resolvers once in the dependency order captured at load time.

public void Resolve()

TryGetDependency<T>(AssetTypeDefinition<T>, out AssetMap<T>?)

Tries to read an immutable dependency candidate from a typed lifecycle callback.

public bool TryGetDependency<T>(AssetTypeDefinition<T> definition, out AssetMap<T>? assets) where T : notnull

Parameters

definition AssetTypeDefinition<T>
assets AssetMap<T>

Returns

bool

Type Parameters

T

TryGetDependency<T>(AssetDefinitionBinding<T>, out AssetMap<T>?)

Tries to read an immutable dependency candidate for an asset definition bound to a host.

public bool TryGetDependency<T>(AssetDefinitionBinding<T> binding, out AssetMap<T>? assets) where T : notnull

Parameters

binding AssetDefinitionBinding<T>
assets AssetMap<T>

Returns

bool

Type Parameters

T

TryIndexIn(string, string?, out int)

Tries to resolve an asset name through a published typed index.

public bool TryIndexIn(string storeType, string? assetName, out int index)

Parameters

storeType string
assetName string
index int

Returns

bool

Validate(ICommonAssetStore)

public void Validate(ICommonAssetStore common)

Parameters

common ICommonAssetStore