Skip to main content

reifydb_runtime/actor/system/
mod.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2025 ReifyDB
3
4//! Unified actor system for ReifyDB.
5//!
6//! This module provides a unified system for all concurrent work:
7//! - **Actor spawning** on a shared work-stealing pool
8//! - **CPU-bound compute** with admission control
9//!
10//! # Platform Differences
11//!
12//! - **Native**: Rayon thread pool for all actors
13//! - **WASM**: All operations execute inline (synchronously)
14
15#[cfg(reifydb_target = "dst")]
16pub mod dst;
17
18#[cfg(all(not(reifydb_single_threaded), not(reifydb_target = "dst")))]
19pub mod native;
20
21#[cfg(all(reifydb_single_threaded, not(reifydb_target = "dst")))]
22pub mod wasm;
23
24#[cfg(reifydb_target = "dst")]
25pub use dst::{ActorHandle, ActorSystem, JoinError};
26#[cfg(all(not(reifydb_single_threaded), not(reifydb_target = "dst")))]
27pub use native::{ActorHandle, ActorSystem, JoinError};
28#[cfg(all(reifydb_single_threaded, not(reifydb_target = "dst")))]
29pub use wasm::{ActorHandle, ActorSystem, JoinError};
30
31#[derive(Debug, Clone, Default)]
32pub struct ActorConfig {
33	pub mailbox_capacity: Option<usize>,
34}
35
36impl ActorConfig {
37	pub fn new() -> Self {
38		Self::default()
39	}
40
41	pub fn mailbox_capacity(mut self, capacity: usize) -> Self {
42		self.mailbox_capacity = Some(capacity);
43		self
44	}
45}