Skip to main content

Crate reifydb_runtime

Crate reifydb_runtime 

Source
Expand description

Runtime management for ReifyDB.

This crate provides a facade over platform-specific runtime implementations:

  • Native: tokio multi-threaded runtime + rayon-based actor system
  • WASM: Single-threaded execution with sequential processing

The API is identical across platforms, with compile-time dispatch ensuring zero runtime overhead.

§Example

use reifydb_runtime::{SharedRuntime, SharedRuntimeConfig};

// Create a runtime with default configuration
let runtime = SharedRuntime::from_config(SharedRuntimeConfig::default());

// Or with custom configuration
let config = SharedRuntimeConfig::default()
    .async_threads(4)
    .compute_threads(4)
    .compute_max_in_flight(16);
let runtime = SharedRuntime::from_config(config);

// Spawn async work
runtime.spawn(async {
    // async work here
});

// Use the actor system for spawning actors and compute
let system = runtime.actor_system();
let handle = system.spawn("my-actor", MyActor::new());

// Run CPU-bound work
let result = system.install(|| expensive_calculation());

Modules§

actor
Actor model for ReifyDB.
context
Runtime context that bundles clock and RNG for the execution engine.
hash
Hash types and functions for ReifyDB.
sync
Synchronization primitives abstraction.

Structs§

SharedRuntime
Shared runtime that can be cloned and passed across subsystems.
SharedRuntimeConfig
Configuration for creating a SharedRuntime.