How zorab0310/titanrt works
TitanRt is a typed reactive runtime: an application supplies a model, while a control thread drives its lifecycle and the model owns optional worker streams. The main path is control inputs → runtime/controller → model; stream workers exchange typed actions and events with the model and can publish state and health. Separate capabilities include NATS bridging, HTTP/gRPC/WebSocket connectors, bounded channel transports, and core-affinity utilities. Edges reflect README statements or the supplied source index; several connector implementations were not sampled, so their detailed call paths are not inferred.
Main entry points: runtime.rs Runtime engine · controller.rs Lifecycle controller · model.rs User model · spawner.rs Stream spawner
Components 23
Runtime lifecycle
- Control inputs
src/control/inputs.rs - Runtime engine
src/runtime.rs - Lifecycle controller
src/control/controller.rs - User model
src/model.rs - Runtime config
src/config.rs - Control policy
src/control/policy.rs
Streams and connectors
- Connector API
src/connector/base.rs - Stream spawner
src/connector/spawner.rs - Stream handle
src/connector/stream.rs - Event hook
src/connector/hook.rs - HTTP streams
src/connector/features/reqwest/stream - gRPC streams
src/connector/features/tonic - WebSocket streams
src/connector/features/websocket/runner.rs - Shared stream features
src/connector/features/shared
I/O and bridge
- Channel traits
src/io/base.rs - Ring buffer
src/io/ringbuffer.rs - MPMC channel
src/io/mpmc.rs - NATS bridge
src/bridges/nats.rs
State and scheduling
- State and health
src/utils/state.rs - Cancellation
src/utils/cancel_token.rs - Core selection
src/utils/core_pinner.rs
Other components
- Application
- NATS service
Connections 27
- Application → Runtime engine: configures and starts
- Application → Control inputs: sends commands
- Runtime engine → Runtime config: reads settings
src/runtime.rs - Runtime engine → Lifecycle controller: drives control
src/runtime.rs - Runtime engine → User model: initializes and executes
src/runtime.rs - Lifecycle controller → Control inputs: handles
src/control/controller.rs - Lifecycle controller → Control policy: dispatches through
src/control/controller.rs - Lifecycle controller → User model: controls lifecycle
src/control/controller.rs - Runtime engine → Ring buffer: creates control channel
src/runtime.rs - Lifecycle controller → Ring buffer: receives inputs
src/control/controller.rs - Channel traits → Ring buffer: implemented by
src/io/ringbuffer.rs - Channel traits → MPMC channel: implemented by
src/io/mpmc.rs - User model → Connector API: owns connectors
- Connector API → Stream spawner: spawns workers
- Stream spawner → Stream handle: creates handles
src/connector/spawner.rs - User model → Stream handle: drains events and sends actions
- WebSocket streams → Event hook: selects emitted events
src/connector/features/websocket/runner.rs - WebSocket streams → Shared stream features: uses actions and events
src/connector/features/websocket/runner.rs - gRPC streams → Shared stream features: uses shared rate limits and events
src/connector/features/tonic/streaming/handle_client.rs - Stream spawner → State and health: provides stream state and health
- User model → Cancellation: receives cancellation token
src/model.rs - Runtime engine → Core selection: optionally pins thread
src/runtime.rs - Stream spawner → Core selection: selects worker cores
- NATS service → NATS bridge: publishes commands and outputs
src/bridges/nats.rs - NATS bridge → Runtime engine: runs runtime
src/bridges/nats.rs - NATS bridge → Control inputs: forwards decoded inputs
src/bridges/nats.rs - NATS bridge → MPMC channel: receives outputs
src/bridges/nats.rs