Table of Contents

Class ResourceNode

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

Default IResource implementation: a concrete tree node backed by a thread-safe child collection. Subclass to override Count or DisposeWithParent, or to add metrics via IMetricSource.

public class ResourceNode : IResource, IDisposable
Inheritance
ResourceNode
Implements
Derived
Inherited Members
Extension Methods

Constructors

ResourceNode(string, ResourceType, IResource, ExhaustionPolicy, string)

Creates a node and registers it under parent, inheriting the parent's Owner.

public ResourceNode(string id, ResourceType type, IResource parent, ExhaustionPolicy exhaustionPolicy = ExhaustionPolicy.None, string name = null)

Parameters

id string

Stable identifier, unique among parent's children. Defaults to the runtime type name when null.

type ResourceType

Resource classification.

parent IResource

Parent node; must be non-null (the root is created internally). This node is added to its children.

exhaustionPolicy ExhaustionPolicy

Diagnostic metadata describing how this node reacts when its capacity is exhausted. None for structural nodes.

name string

Human-readable display label. Defaults to id when null.

Properties

Children

Direct child resources, in no particular order.

public IEnumerable<IResource> Children { get; }

Property Value

IEnumerable<IResource>

Count

Default: no count. Subclasses that wrap a countable resource (ComponentTable, Segments folder, Index, …) override this to surface a live count to the Workbench tree.

public virtual int? Count { get; }

Property Value

int?

CreatedAt

UTC timestamp captured when this node was constructed.

public DateTime CreatedAt { get; }

Property Value

DateTime

DisposeWithParent

Whether this node is disposed by its parent's Dispose(bool) cascade. Default true. A node whose lifecycle is owned by something other than the resource tree — e.g. a profiler exporter owned by TyphonProfiler — overrides this to false: it stays registered in the tree for display, but is disposed only by its real owner, never by an ancestor's teardown.

public virtual bool DisposeWithParent { get; }

Property Value

bool

ExhaustionPolicy

Diagnostic metadata indicating how this resource responds when its capacity limit is reached.

public ExhaustionPolicy ExhaustionPolicy { get; }

Property Value

ExhaustionPolicy

Remarks

None for intermediate/structural nodes that don't own a bounded resource.

Id

Stable identifier, unique among siblings. Forms one segment of the node's tree path (e.g. "PageCache" in "Storage/PageCache").

public string Id { get; }

Property Value

string

Name

Human-readable display label. May equal Id for structural nodes whose id is already self-describing (e.g. "Storage"), but for resources with synthetic ids (GUIDs, hex suffixes) this is the user-facing name the Workbench and diagnostics should surface.

public string Name { get; }

Property Value

string

Owner

Registry that owns the tree this node belongs to.

public IResourceRegistry Owner { get; }

Property Value

IResourceRegistry

Parent

Parent node in the tree, or null for the root.

public IResource Parent { get; }

Property Value

IResource

Type

Classification of this resource, used for filtering and display.

public ResourceType Type { get; }

Property Value

ResourceType

Methods

Dispose()

Disposes this node and, recursively, every child whose DisposeWithParent is true.

public void Dispose()

Dispose(bool)

Releases child resources. When disposing is true, cascades disposal to each child except those whose DisposeWithParent is false (their lifecycle is owned elsewhere), then clears the child set.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true when called from Dispose(); false from a finalizer, in which case this is a no-op.

RegisterChild(IResource)

Attaches child under this node and raises NodeMutated with Added.

public bool RegisterChild(IResource child)

Parameters

child IResource

The resource to attach.

Returns

bool

true if attached; false if a child with the same Id is already registered.

RemoveChild(IResource)

Detaches resource from this node and raises NodeMutated with Removed.

public bool RemoveChild(IResource resource)

Parameters

resource IResource

The child resource to detach.

Returns

bool

true if detached; false if it was not a child of this node.