Table of Contents

Class ResourceRegistry

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

Default implementation of IResourceRegistry. Builds a hierarchical tree with eight subsystem nodes under Root, created once at construction.

public class ResourceRegistry : IResourceRegistry, IDisposable
Inheritance
ResourceRegistry
Implements
Inherited Members

Remarks

Tree structure:

Root
├── Storage/          (PageCache, ManagedPagedMMF)
├── DataEngine/       (DatabaseEngine, ComponentTables)
├── Durability/       (WAL, Checkpoint)
├── Allocation/       (MemoryAllocator, Bitmaps)
├── Synchronization/  (EpochManager, latch pools)
├── Timer/            (HighResolutionSharedTimerService)
│   └── Dedicated/    (HighResolutionTimerService instances)
├── Runtime/          (DAG scheduler, tick loop, worker pool)
└── Profiler/         (Tracy-style capture pipeline)

Constructors

ResourceRegistry(ResourceRegistryOptions)

Creates a new resource registry with the standard subsystem tree.

public ResourceRegistry(ResourceRegistryOptions options)

Parameters

options ResourceRegistryOptions

Properties

Allocation

Allocation subsystem node (MemoryAllocator, Bitmaps).

public IResource Allocation { get; }

Property Value

IResource

DataEngine

Data engine subsystem node (DatabaseEngine, ComponentTables).

public IResource DataEngine { get; }

Property Value

IResource

Durability

Durability subsystem node (WAL, Checkpoint).

public IResource Durability { get; }

Property Value

IResource

Name

Name of this registry instance.

public string Name { get; }

Property Value

string

Profiler

Profiler subsystem node (Tracy-style consumer thread + exporters).

public IResource Profiler { get; }

Property Value

IResource

Root

Root node of the resource tree.

public IResource Root { get; }

Property Value

IResource

Runtime

Runtime subsystem node (DAG scheduler, tick loop, worker pool).

public IResource Runtime { get; }

Property Value

IResource

Storage

Storage subsystem node (PageCache, ManagedPagedMMF).

public IResource Storage { get; }

Property Value

IResource

Synchronization

Synchronization subsystem node (EpochManager, latch pools).

public IResource Synchronization { get; }

Property Value

IResource

Timer

Timer subsystem node (high-resolution shared and dedicated timers).

public IResource Timer { get; }

Property Value

IResource

TimerDedicated

Timer/Dedicated sub-node for isolated single-handler timers.

public IResource TimerDedicated { get; }

Property Value

IResource

Methods

Dispose()

Disposes all resources in the tree, subsystem by subsystem, in reverse-dependency order.

public void Dispose()

Remarks

Teardown order is load-bearing. DataEngine's graceful shutdown runs a final checkpoint plus PersistArchetypeState / PersistEngineState (durability rule CX-06) that read the Storage (ManagedPagedMMF), Durability (WAL) and Synchronization (EpochManager) subsystems — so those must outlive it. A bare Root.Dispose() cascades children in ConcurrentDictionary<TKey, TValue> enumeration order, which is unspecified — when Storage happened to enumerate before DataEngine the MMF was torn down under the still-running engine teardown, faulting with a null page table / uninitialized segment. So dispose subsystems explicitly here, dependents first; the trailing Root.Dispose() is a safety net for the root and any subsystem not listed (already-disposed nodes are idempotent no-ops).

FindByPath(string, string)

Finds a resource by its full path from root.

public IResource FindByPath(string path, string separator = "/")

Parameters

path string

Full path (e.g., "Root/DataEngine/DatabaseEngine_abc123/ComponentTable_Player").

separator string

Path separator (default: "/").

Returns

IResource

The resource at the path, or null if not found.

GetSubsystem(ResourceSubsystem)

Gets the subsystem node for the specified category.

public IResource GetSubsystem(ResourceSubsystem subsystem)

Parameters

subsystem ResourceSubsystem

Returns

IResource

Register<T>(T, ResourceSubsystem)

Registers a resource under the specified subsystem.

public IResource Register<T>(T resource, ResourceSubsystem subsystem) where T : IResource

Parameters

resource T
subsystem ResourceSubsystem

Returns

IResource

The subsystem node (for fluent chaining or parent assignment).

Type Parameters

T

Events

NodeMutated

Raised whenever a resource is added to or removed from the graph. Subscribers must not throw (the registry isolates faulty handlers but fault-tolerance is best-effort) and must not mutate the graph from within the handler (would re-enter and cause recursive raise).

public event Action<ResourceMutationEventArgs> NodeMutated

Event Type

Action<ResourceMutationEventArgs>