Actor-RTC Runtime Layer
Runtime infrastructure for the Actor-RTC framework, providing complete Actor lifecycle management and message transport capabilities.
Overview
actr-runtime is the core runtime library that powers Actor nodes. It provides:
- Actor Lifecycle: System initialization, node startup/shutdown
- Message Transport: Multi-layer architecture (Wire → Transport → Gate → Dispatch)
- Communication Modes: Intra-process (zero-copy) and cross-process (WebRTC/WebSocket)
- Message Persistence: SQLite-backed mailbox with ACID guarantees
Architecture Layers
┌─────────────────────────────────────────────────────┐
│ Lifecycle Management (ActrSystem → ActrNode → ActrRef)
├─────────────────────────────────────────────────────┤
│ Layer 3: Inbound Dispatch │ DataStreamRegistry
│ (Fast Path Routing) │ MediaFrameRegistry
├─────────────────────────────────────────────────────┤
│ Layer 2: Outbound Gate │ InprocOutGate
│ (Message Sending) │ OutprocOutGate
├─────────────────────────────────────────────────────┤
│ Layer 1: Transport │ Lane (core abstraction)
│ (Channel Management) │ InprocTransportManager
│ │ OutprocTransportManager
├─────────────────────────────────────────────────────┤
│ Layer 0: Wire │ WebRtcGate
│ (Physical Connections) │ WebRtcCoordinator
│ │ SignalingClient
└─────────────────────────────────────────────────────┘
Core Types
Lifecycle Management
The runtime follows a three-phase lifecycle:
use *;
async
Transport Abstraction
Lane is the core transport abstraction, representing a unidirectional message channel:
use Lane;
use PayloadType;
// Lane supports 4 variants:
// - WebRtcDataChannel: Reliable/Signal/LatencyFirst
// - WebRtcMediaTrack: Real-time media
// - Mpsc: Intra-process (zero-copy)
// - WebSocket: Fallback transport
// Send message through lane
lane.send.await?;
// Receive from lane
let data = lane.recv.await?;
Communication Modes
Intra-process (Shell ↔ Workload)
use InprocTransportManager;
let mgr = new;
// Zero-serialization, direct RpcEnvelope passing
let response = mgr.send_request.await?;
Cross-process (WebRTC/WebSocket)
use OutprocTransportManager;
let mgr = new;
// Protobuf serialization, automatic protocol negotiation
mgr.send.await?;
Message Persistence
All incoming messages go through the Mailbox (State Path):
use ;
// Enqueue message (persisted to SQLite)
let msg_id = mailbox.enqueue.await?;
// Dequeue batch (ordered by priority)
let messages = mailbox.dequeue.await?;
// Process and acknowledge
for msg in messages
Feature Status
✅ Implemented
- Actor lifecycle management (ActrSystem/ActrNode/ActrRef)
- 4-Lane transport architecture (WebRTC DataChannel + MediaTrack)
- WebSocket signaling client
- Intra-process zero-copy channels
- SQLite-backed mailbox with priorities
- Context factory for message handling
⏳ Pending
- Health checks and metrics collection
- Service discovery and registration
- Prometheus metrics export
- Distributed tracing integration
Usage Note
This is a low-level runtime library. For application development, use the high-level
framework APIs provided by actr-framework which builds on top of this runtime.