theater/lib.rs
1//! # Theater Actor System
2//!
3//! Theater is a runtime for managing and executing WebAssembly actors in a distributed system.
4//! It provides a framework for creating, managing, and communicating with actors that are
5//! implemented as WebAssembly components.
6//!
7//! ## Core Features
8//!
9//! * **Actor Management**: Create, start, stop, and monitor actors
10//! * **State Management**: Persistent actor state with event chain tracking
11//! * **Message Passing**: Communication between actors and external systems
12//! * **WebAssembly Integration**: Run actors as sandboxed WebAssembly components
13//! * **Extensible Handlers**: Support for HTTP, WebSockets, and custom protocols
14//!
15//! ## Architecture
16//!
17//! Theater is built around these key components:
18//!
19//! * `TheaterRuntime`: The central runtime that manages the lifecycle of actors
20//! * `ActorRuntime`: Manages the execution environment for a single actor
21//! * `ActorHandle`: Provides an interface for interacting with actors
22//! * `StateChain`: Tracks the history of state changes for an actor
23//!
24//! ## Example Usage
25//!
26//!
27//! ## Security and Safety
28//!
29//! Theater runs actors in isolated WebAssembly environments with configurable resource limits
30//! and capabilities. This provides strong security boundaries between actors and between
31//! actors and the host system.
32
33use anyhow::Result;
34
35pub mod actor;
36pub mod chain;
37pub mod config;
38pub mod errors;
39pub mod events;
40
41pub mod host;
42pub mod id;
43pub mod logging;
44pub mod messages;
45pub mod metrics;
46pub mod shutdown;
47pub mod store;
48pub mod theater_runtime;
49pub mod utils;
50mod wasm;
51
52pub use actor::ActorError;
53
54pub use actor::ActorHandle;
55pub use actor::ActorOperation;
56pub use actor::ActorRuntime;
57pub use actor::ActorStore;
58pub use actor::StartActorResult;
59pub use chain::{ChainEvent, StateChain};
60pub use config::actor_manifest::{
61 HandlerConfig, HttpServerHandlerConfig, InterfacesConfig, ManifestConfig, MessageServerConfig,
62 RandomHandlerConfig,
63};
64pub use errors::TheaterRuntimeError;
65pub use id::TheaterId;
66pub use messages::ChannelEvent;
67pub use metrics::{
68 ActorMetrics, MetricsCollector, OperationMetrics, OperationStats, ResourceMetrics,
69};
70pub use shutdown::{ShutdownController, ShutdownReceiver, ShutdownSignal, ShutdownType};
71pub use store::{ContentRef, ContentStore, Label};
72pub use theater_runtime::TheaterRuntime;
73pub use wasm::{MemoryStats, WasmError};