Skip to main content

reifydb_runtime/actor/system/
mod.rs

1// SPDX-License-Identifier: AGPL-3.0-or-later
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 = "native")]
16pub mod native;
17
18#[cfg(reifydb_target = "wasm")]
19pub mod wasm;
20
21#[cfg(reifydb_target = "native")]
22pub use native::{ActorHandle, ActorSystem, ActorSystemConfig, JoinError};
23#[cfg(reifydb_target = "wasm")]
24pub use wasm::{ActorHandle, ActorSystem, ActorSystemConfig, JoinError};
25
26#[derive(Debug, Clone)]
27pub struct ActorConfig {
28	pub mailbox_capacity: Option<usize>,
29}
30
31impl Default for ActorConfig {
32	fn default() -> Self {
33		Self {
34			mailbox_capacity: None,
35		}
36	}
37}
38
39impl ActorConfig {
40	pub fn new() -> Self {
41		Self::default()
42	}
43
44	pub fn mailbox_capacity(mut self, capacity: usize) -> Self {
45		self.mailbox_capacity = Some(capacity);
46		self
47	}
48}