Class ResourceRegistry
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
optionsResourceRegistryOptions
Properties
Allocation
Allocation subsystem node (MemoryAllocator, Bitmaps).
public IResource Allocation { get; }
Property Value
DataEngine
Data engine subsystem node (DatabaseEngine, ComponentTables).
public IResource DataEngine { get; }
Property Value
Durability
Durability subsystem node (WAL, Checkpoint).
public IResource Durability { get; }
Property Value
Name
Name of this registry instance.
public string Name { get; }
Property Value
Profiler
Profiler subsystem node (Tracy-style consumer thread + exporters).
public IResource Profiler { get; }
Property Value
Root
Root node of the resource tree.
public IResource Root { get; }
Property Value
Runtime
Runtime subsystem node (DAG scheduler, tick loop, worker pool).
public IResource Runtime { get; }
Property Value
Storage
Storage subsystem node (PageCache, ManagedPagedMMF).
public IResource Storage { get; }
Property Value
Synchronization
Synchronization subsystem node (EpochManager, latch pools).
public IResource Synchronization { get; }
Property Value
Timer
Timer subsystem node (high-resolution shared and dedicated timers).
public IResource Timer { get; }
Property Value
TimerDedicated
Timer/Dedicated sub-node for isolated single-handler timers.
public IResource TimerDedicated { get; }
Property Value
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
pathstringFull path (e.g., "Root/DataEngine/DatabaseEngine_abc123/ComponentTable_Player").
separatorstringPath 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
subsystemResourceSubsystem
Returns
Register<T>(T, ResourceSubsystem)
Registers a resource under the specified subsystem.
public IResource Register<T>(T resource, ResourceSubsystem subsystem) where T : IResource
Parameters
resourceTsubsystemResourceSubsystem
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