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(not(reifydb_single_threaded))]
16pub mod native;
17
18#[cfg(reifydb_single_threaded)]
19pub mod wasm;
20
21#[cfg(not(reifydb_single_threaded))]
22pub use native::{ActorHandle, ActorSystem, JoinError};
23#[cfg(reifydb_single_threaded)]
24pub use wasm::{ActorHandle, ActorSystem, JoinError};
25
26#[derive(Debug, Clone, Default)]
27pub struct ActorConfig {
28	pub mailbox_capacity: Option<usize>,
29}
30
31impl ActorConfig {
32	pub fn new() -> Self {
33		Self::default()
34	}
35
36	pub fn mailbox_capacity(mut self, capacity: usize) -> Self {
37		self.mailbox_capacity = Some(capacity);
38		self
39	}
40}