actr_runtime/lib.rs
1//! # actr-runtime -- Business Dispatch Layer
2//!
3//! The streamlined `actr-runtime` contains only pure business dispatch logic,
4//! with **no dependency** on tokio, WebRTC, wasmtime or other platform-specific libraries,
5//! and can be compiled for both native and `wasm32-unknown-unknown` targets.
6//!
7//! ## Responsibility Separation
8//!
9//! ```text
10//! actr-hyper <- Infrastructure layer (transport, wire, signaling, WASM engine ...)
11//! actr-runtime <- Business dispatch layer (ACL + dispatch + lifecycle hooks) <- you are here
12//! actr-framework <- SDK interface layer (trait definitions: Workload, Context, MessageDispatcher)
13//! actr-protocol <- Data definition layer (protobuf types)
14//! ```
15//!
16//! ## Core Types
17//!
18//! - [`ActrDispatch`] -- Holds `Arc<Workload>` + optional ACL, provides `dispatch()` entry point
19//! - [`check_acl_permission`] -- Pure function for ACL permission evaluation
20//!
21//! ## Usage Example
22//!
23//! ```rust,ignore
24//! use actr_runtime::ActrDispatch;
25//!
26//! let dispatch = ActrDispatch::new(Arc::new(workload), acl);
27//!
28//! // Lifecycle
29//! dispatch.on_start(&ctx).await?;
30//!
31//! // Message dispatch
32//! let response = dispatch.dispatch(&self_id, caller_id.as_ref(), envelope, &ctx).await?;
33//!
34//! // Shutdown
35//! dispatch.on_stop(&ctx).await?;
36//! ```
37
38pub mod acl;
39pub mod dispatch;
40
41// -- Core exports --
42pub use acl::check_acl_permission;
43pub use dispatch::ActrDispatch;
44
45// -- Re-export actr-framework core traits for convenient downstream imports --
46pub use actr_framework::{Context, MessageDispatcher, Workload};
47
48// -- Re-export commonly used actr-protocol types --
49pub use actr_protocol::{Acl, ActorResult, ActrError, ActrId, ActrType, RpcEnvelope};