Expand description
Component dependency graph — the single source of truth for configuration Component Dependency Graph — the single source of truth for DrasiLib configuration.
The ComponentGraph maintains a directed graph of all components (Instance, Sources,
Queries, Reactions, BootstrapProviders, IdentityProviders) and their bidirectional
relationships. The DrasiLib instance itself is the root node.
All three managers (SourceManager, QueryManager, ReactionManager) share the same
Arc<RwLock<ComponentGraph>>. Managers register components in the graph first
(registry-first pattern), then create and store runtime instances. The graph is the
authoritative source for component relationships, dependency tracking, and lifecycle
events.
§Event Emission
The graph emits ComponentEvents via a built-in broadcast::Sender whenever
components are added, removed, or change status. Subscribers (ComponentGraphSource,
EventHistory, external consumers) receive events directly from the graph.
§Status Update Channel
Components report status changes via a shared mpsc::Sender<ComponentUpdate>.
A dedicated graph update loop (spawned externally) receives from this channel and
applies updates to the graph, emitting broadcast events. This decouples components
from the graph lock — status reporting is fire-and-forget.
Structural mutations (add_component, remove_component, add_relationship) and
command-initiated transitions (Starting, Stopping) are applied directly by
managers, which hold the graph write lock on the cold path.
Structs§
- Component
Graph - Central component dependency graph — the single source of truth.
- Component
Node - A node in the component graph.
- Component
Status Handle - A clonable handle for reading, writing, and reporting component status.
- Graph
Edge - A serializable edge in the graph snapshot
- Graph
Snapshot - Serializable snapshot of the entire component graph.
- Graph
Transaction - A transactional wrapper for batching graph mutations.
Enums§
- Component
Kind - Type of component in the graph
- Component
Update - A status or metric update sent from a component to the graph update loop.
- Relationship
Kind - Type of relationship between components (bidirectional pairs)
Functions§
- wait_
for_ status - Wait for a component to reach one of the target statuses, with a timeout.
Type Aliases§
- Component
Update Receiver - Receiver half of the component update channel.
- Component
Update Sender - Sender half of the component update channel.