Component Relationships
This page details how the various components of Theater interact with each other, providing a deeper understanding of the system's internal architecture.
Core Components
Theater Runtime
The Theater Runtime is the central orchestration component that manages the entire system:
- Relationship with Actor Executor: The Runtime uses the Actor Executor to instantiate and run actors
- Relationship with Store: The Runtime coordinates with the Store for state persistence
- Relationship with Event Chain: The Runtime records all system events in the Chain
Actor Executor
The Actor Executor handles WebAssembly component instantiation and execution:
- Relationship with WASM Components: Loads and instantiates WebAssembly components
- Relationship with Host Functions: Provides host functions to running components
- Relationship with Runtime: Reports execution results back to the Runtime
Store System
The Store provides content-addressable storage for actor state:
- Relationship with Actors: Provides state storage and retrieval for actors
- Relationship with Runtime: Coordinates with the Runtime for state management
- Relationship with Event Chain: State changes are recorded in the Event Chain
Event Chain
The Event Chain records all system events:
- Relationship with Runtime: Receives events from the Runtime
- Relationship with Store: Records state changes from the Store
- Relationship with CLI Tools: Provides data for inspection and debugging
Secondary Components
CLI
The CLI provides user interaction with the Theater system:
- Relationship with Runtime: Sends commands to the Runtime
- Relationship with Event Chain: Retrieves and displays events
- Relationship with Store: Accesses stored content
Handlers
Handlers extend actor functionality:
- Relationship with Actor Executor: Registered with the Executor
- Relationship with Runtime: Managed by the Runtime
- Relationship with Event Chain: Handler invocations are recorded
Component Interaction Patterns
Creation Flow
The sequence of component interactions during actor creation:
- CLI or parent actor requests actor creation
- Runtime processes request
- Store retrieves component bytes
- Actor Executor instantiates component
- Runtime initializes actor state
- Event Chain records creation
Message Processing Flow
The sequence of component interactions during message processing:
- Message arrives at Runtime
- Runtime records message in Event Chain
- Runtime delivers message to target actor
- Actor Executor invokes appropriate handler
- Actor may access state via Store
- Actor response is recorded in Event Chain
- Response is delivered to sender
Failure Handling Flow
The sequence of component interactions during failure handling:
- Actor Executor detects failure
- Runtime records failure in Event Chain
- Runtime notifies supervisor
- Supervisor decides on action
- Runtime implements supervisory action
- Event Chain records recovery action
Understanding these component relationships and interaction patterns provides insight into how Theater operates internally and how its various parts work together to create a cohesive system.