Skip to main content

reifydb_runtime/pool/
mod.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2026 ReifyDB
3
4//! Execution domains split by workload shape so one kind of work cannot starve another: long-lived actors on the
5//! actor pool (`coordination` for tiny high-frequency handlers, `flow` for heavy flow execution), short-lived work
6//! on the task pool, data-parallel work on the compute pool, async I/O on the embedded tokio runtime.
7
8#[cfg(all(not(reifydb_single_threaded), not(reifydb_dst)))]
9pub(crate) mod actor_pool;
10
11#[cfg(all(not(reifydb_single_threaded), not(reifydb_dst)))]
12pub mod compute;
13
14#[cfg(all(not(reifydb_single_threaded), not(reifydb_dst)))]
15mod host;
16
17#[cfg(all(not(reifydb_single_threaded), not(reifydb_dst)))]
18pub(crate) mod task;
19
20#[cfg(any(reifydb_single_threaded, reifydb_dst))]
21mod wasm;
22
23#[cfg(all(not(reifydb_single_threaded), not(reifydb_dst)))]
24pub use host::Pools;
25#[cfg(any(reifydb_single_threaded, reifydb_dst))]
26pub use wasm::Pools;
27
28#[derive(Debug, Clone)]
29pub struct PoolConfig {
30	pub coordination_threads: usize,
31
32	pub flow_threads: usize,
33
34	pub maintenance_threads: usize,
35
36	pub task_threads: usize,
37
38	pub compute_threads: usize,
39
40	pub async_threads: usize,
41}
42
43impl Default for PoolConfig {
44	fn default() -> Self {
45		Self {
46			coordination_threads: 2,
47			flow_threads: 2,
48			maintenance_threads: 1,
49			task_threads: 2,
50			compute_threads: 2,
51			async_threads: 1,
52		}
53	}
54}
55
56impl PoolConfig {
57	pub fn sync_only() -> Self {
58		Self {
59			coordination_threads: 1,
60			flow_threads: 1,
61			maintenance_threads: 1,
62			task_threads: 1,
63			compute_threads: 1,
64			async_threads: 0,
65		}
66	}
67}