Skip to main content

RuntimeConfig

Struct RuntimeConfig 

Source
pub struct RuntimeConfig {
Show 17 fields pub workers: usize, pub quantum: u32, pub mailbox: MailboxConfig, pub max_flows: u32, pub max_ask_waits: u32, pub max_host_awaits: u32, pub max_links: u32, pub max_monitors: u32, pub max_registry_names: u32, pub host_await: Option<Arc<dyn HostAwaitBridge>>, pub distribution: Option<Arc<DistributionBridge>>, pub max_runtime_bytes: usize, pub trust: TrustLevel, pub paranoid_jumps: bool, pub output: Arc<dyn OutputSink>, pub quota: QuotaConfig, pub jit: JitConfig,
}
Expand description

Tunables for Runtime::new. Everything has a sensible default via RuntimeConfig::default so the common case is Runtime::new(chunk).

Fields§

§workers: usize

Number of worker OS threads. Defaults to the number of logical CPUs — one worker per core is the right starting point for a CPU-bound M:N scheduler; embedders running alongside other CPU-heavy work on the same machine may want fewer.

§quantum: u32

Instructions a flow runs before being preempted back to the scheduler even if it never hits Yield.

§mailbox: MailboxConfig

Memory + overflow contract applied to every flow mailbox spawned by this runtime (bytecode Spawn and host spawn). See MailboxConfig / docs/mailbox.md.

§max_flows: u32

Hard cap on concurrently live flows (0 = unlimited). Checked on every host and bytecode spawn.

§max_ask_waits: u32

Hard cap on outstanding Ask / AskTimeout waiters process-wide (0 = unlimited). Each asker holds at most one wait; this bounds the total index size when many flows park against a silent target. See crate::docs::security (DoS) and Self::sandbox.

§max_host_awaits: u32

Hard cap on outstanding HostAwait parkers process-wide (0 = unlimited). Each flow holds at most one await.

§max_links: u32

Hard cap on live process-wide links (0 = unlimited).

Accounting is performed by [super::link::LinkStore] itself, under the same synchronization that protects the link table.

§max_monitors: u32

Hard cap on live process-wide monitors (0 = unlimited).

Accounting is performed by [super::monitor::MonitorStore] itself.

§max_registry_names: u32

Hard cap on live process-wide registry names (0 = unlimited).

[super::registry::RegistryStore] counts only successfully registered names.

§host_await: Option<Arc<dyn HostAwaitBridge>>

Host async bridge for crate::Opcode::HostAwait. None fails any HostAwait closed. Not a CallNative / std-native slot.

§distribution: Option<Arc<DistributionBridge>>

Host queue for crate::Opcode::SendRemote. None fails that opcode. Byteflow does not open sockets; the embedder drains the bridge.

§max_runtime_bytes: usize

Process-wide memory ceiling for heap charges (Str / Bytes register stores and shared crate::HeapStr / crate::HeapBytes). Independent of per-flow crate::QuotaConfig::mem_limit and mailbox byte budgets. Default: 256 MiB.

§trust: TrustLevel

Constant-pool trust for crate::verify_with at runtime construction. Default is crate::TrustLevel::Untrusted (fail closed).

§paranoid_jumps: bool

Enables defensive jump validation for every VM.

When Self::trust is crate::TrustLevel::Untrusted, paranoid jump checking is always enabled regardless of this flag.

§output: Arc<dyn OutputSink>

Where bytecode print (native index 0) writes when using crate::std_native_table_with. Ignored if you supply your own table.

§quota: QuotaConfig

Per-flow CPU / memory / spawn-send rate budgets.

§jit: JitConfig
Available on crate feature jit only.

Trace JIT settings (feature = "jit"). Ignored when the feature is off.

Implementations§

Source§

impl RuntimeConfig

Source

pub fn sandbox() -> Self

Starting point for untrusted modules: tight per-flow quotas plus process-wide caps on live flows, Ask waits, HostAwaits, links, monitors, and registry names. Tune under real load before using as a production default.

Trait Implementations§

Source§

impl Clone for RuntimeConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RuntimeConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RuntimeConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.