Skip to main content

Crate theater

Crate theater 

Source
Expand description

§Theater Actor System

Theater is a runtime for managing and executing WebAssembly actors in a distributed system. It provides a framework for creating, managing, and communicating with actors that are implemented as WebAssembly components.

§Core Features

  • Actor Management: Create, start, stop, and monitor actors
  • State Management: Persistent actor state with event chain tracking
  • Message Passing: Communication between actors and external systems
  • WebAssembly Integration: Run actors as sandboxed WebAssembly components
  • Extensible Handlers: Support for HTTP, WebSockets, and custom protocols

§Architecture

Theater is built around these key components:

  • TheaterRuntime: The central runtime that manages the lifecycle of actors
  • ActorRuntime: Manages the execution environment for a single actor
  • ActorHandle: Provides an interface for interacting with actors
  • StateChain: Tracks the history of state changes for an actor

§Example Usage

§Security and Safety

Theater runs actors in isolated WebAssembly environments with configurable resource limits and capabilities. This provides strong security boundaries between actors and between actors and the host system.

Re-exports§

pub use actor::ActorError;
pub use actor::ActorHandle;
pub use actor::ActorOperation;
pub use actor::ActorRuntime;
pub use actor::ActorStore;
pub use actor::StartActorResult;
pub use chain::ChainEvent;
pub use chain::HttpReplayChain;
pub use chain::StateChain;
pub use config::actor_manifest::HandlerConfig;
pub use config::actor_manifest::HttpServerHandlerConfig;
pub use config::actor_manifest::InterfacesConfig;
pub use config::actor_manifest::ManifestConfig;
pub use config::actor_manifest::MessageServerConfig;
pub use config::actor_manifest::RandomHandlerConfig;
pub use errors::TheaterRuntimeError;
pub use id::TheaterId;
pub use messages::ChannelEvent;
pub use metrics::ActorMetrics;
pub use metrics::MetricsCollector;
pub use metrics::OperationMetrics;
pub use metrics::OperationStats;
pub use metrics::ResourceMetrics;
pub use replay::HostFunctionCall;
pub use replay::ReplayHandler;
pub use replay::ReplayState;
pub use shutdown::ShutdownController;
pub use shutdown::ShutdownReceiver;
pub use shutdown::ShutdownSignal;
pub use shutdown::ShutdownType;
pub use store::ContentRef;
pub use store::ContentStore;
pub use store::Label;
pub use theater_runtime::TheaterRuntime;
pub use interceptor::RecordingInterceptor;
pub use interceptor::ReplayRecordingInterceptor;
pub use pack_bridge::IntoValue;
pub use pack_bridge::PackInstance;

Modules§

actor
Actor System
chain
Event Chain System
config
errors
events
handler
id
Theater ID System
interceptor
Call Interceptors
logging
messages
metrics
pack_bridge
Pack Bridge Module
replay
Replay Module
shutdown
store
theater_runtime
Theater Runtime
utils

Structs§

AsyncCtx
Async context for async host functions.
AsyncRuntime
An async-enabled package runtime.
Ctx
Context wrapper providing ergonomic access to store data and memory.
HostLinkerBuilder
Builder for registering host functions with a Linker.

Enums§

LinkerError
Errors from linker operations
Value
A runtime value that can be passed across package boundaries
ValueType
Runtime type representation for CGRF v2

Traits§

CallInterceptor
Trait for intercepting calls at the Pack runtime level.