Skip to main content

NodeConfig

Struct NodeConfig 

Source
pub struct NodeConfig {
Show 15 fields pub peer_id: PeerId, pub cycle_op_budget: Option<usize>, pub max_pending_async: Option<usize>, pub max_outbound_queue: Option<usize>, pub bus_capacity: usize, pub per_hop_budget_ns: u64, pub envelope_caps: EnvelopeCaps, pub backpressure_high_water_pct: u8, pub backpressure_k_before_silent: u32, pub backpressure_min_notice_interval_ns: u64, pub ingress_byte_budget: usize, pub max_app_event_bytes: usize, pub max_invoke_inputs: usize, pub max_invoke_bytes: usize, pub max_completion_result_bytes: usize,
}
Expand description

Construction-time configuration for a Node.

Fields§

§peer_id: PeerId

Local peer identity. Required at construction - the Node holds its own identity from the moment it exists.

§cycle_op_budget: Option<usize>

Soft per-poll-cycle budget - the engine voluntarily yields after N op-invocations to honor caller-side backpressure. None disables the budget guard.

§max_pending_async: Option<usize>

Cap on the number of in-flight DispatchResult::Async commands. When the cap is hit, further async dispatches fail synchronously with OpError("pending-async limit exceeded"). None disables the cap.

§max_outbound_queue: Option<usize>

Cap on the outbound envelope queue depth. When the cap is hit, the oldest envelope is dropped (FIFO) and a count surfaces via EngineStep::OutboundDropped. None disables the cap.

§bus_capacity: usize

Bus capacity. Overflow drops the oldest event + bumps a counter.

§per_hop_budget_ns: u64

Per-target-boundary budget in nanoseconds. The Engine’s deadline-stamping path multiplies this by the static chain_depth metadata on each outbound wire.Send to size the call’s deadline. Sized to represent the worst-case round-trip cost of one network boundary; chains crossing multiple boundaries pay the multiplier.

§envelope_caps: EnvelopeCaps

inbound envelope decode caps the crate::envelope::EnvelopeCodec::decode_capped consults on every inbound buffer. Production defaults match the design’s “16 MiB / 256 / 4 MiB / 4 KiB” recommendation; edge deployments use EnvelopeCaps::edge() for tighter bounds (256 KiB / 16 / 64 KiB / 512). Custom caps via Self::with_envelope_caps.

§backpressure_high_water_pct: u8

Receiver-side back-pressure high-water mark, as a percentage of the ingress queue capacity. Once ingress depth reaches this fraction, the framework emits a BackoffNotice envelope to each contributing sender per the backpressure protocol design at docs/internal/superpowers/specs/2026-06-23-backpressure-runtime.md §6. Default DEFAULT_HIGH_WATER_PCT (75).

§backpressure_k_before_silent: u32

K = notices-without-recovery before the receiver transitions the sender to silent-drop mode. Default DEFAULT_K_BEFORE_SILENT (3) - matches the RttEma::is_warm threshold at bb-runtime/src/framework/rtt_tracker.rs:126-128.

§backpressure_min_notice_interval_ns: u64

Minimum interval enforced between successive BackoffNotice emissions to the same sender. Acts as a hard lower bound on the duplicate-suppression window so a flood of inbound envelopes from one peer produces at most one notice per interval. Default DEFAULT_MIN_NOTICE_INTERVAL_NS (1 second).

§ingress_byte_budget: usize

Total in-flight ingress bytes the engine may hold across the ingress queue + slot table + pending async completion buffers at any instant. Wire and application ingress boundaries try_charge against this cap before installing a payload; on overflow the offending bytes are dropped and the appropriate BudgetExceeded InfraEvent is emitted. Default DEFAULT_INGRESS_BYTE_BUDGET (256 MiB); edge preset EDGE_INGRESS_BYTE_BUDGET (8 MiB).

§max_app_event_bytes: usize

Per-AppEvent payload cap (host-driven push). Default DEFAULT_MAX_APP_EVENT_BYTES (1 MiB); edge preset EDGE_MAX_APP_EVENT_BYTES (64 KiB). On overflow, Node::deliver_event returns DeliveryError::OversizePayload AND emits AppIngressError { kind: PerItemCapExceeded }.

§max_invoke_inputs: usize

Per-Invoke input-count cap. Default DEFAULT_MAX_INVOKE_INPUTS (100); edge preset EDGE_MAX_INVOKE_INPUTS (16). Caps the number of (name, bytes) pairs an invoke() call may carry before any per-input allocation runs.

§max_invoke_bytes: usize

Per-Invoke cumulative payload cap. Default DEFAULT_MAX_INVOKE_BYTES (10 MiB); edge preset EDGE_MAX_INVOKE_BYTES (256 KiB). Sum of every input’s payload length crossing the boundary.

§max_completion_result_bytes: usize

Per-CompletionHandle result-payload cap. Default DEFAULT_MAX_COMPLETION_RESULT_BYTES (4 MiB); edge preset EDGE_MAX_COMPLETION_RESULT_BYTES (64 KiB). The detail string on fail() is independently capped at 4 KiB (truncated rather than rejected). Component sees an async-op timeout in place of a dropped completion.

Implementations§

Source§

impl NodeConfig

Source

pub fn new(peer_id: PeerId) -> Self

Construct with the given local peer identity and production-conservative defaults for every other field.

Source

pub fn new_edge(peer_id: PeerId) -> Self

Convenience constructor with the tighter edge-device presets applied to every cap: envelope caps (256 KiB / 16 / 64 KiB / 512), ingress budget (8 MiB), per-AppEvent (64 KiB), per-Invoke (16 inputs / 256 KiB), and per-Completion (64 KiB).

Source

pub fn with_envelope_caps(self, caps: EnvelopeCaps) -> Self

Override the inbound envelope decode caps.

Source

pub fn with_cycle_op_budget(self, budget: usize) -> Self

Cap how many op-invocations a single Node::poll() may issue before voluntarily yielding back to the host.

Source

pub fn without_cycle_op_budget(self) -> Self

Disable the per-cycle op budget - let poll() drain the frontier to quiescence in a single cycle.

Source

pub fn with_max_pending_async(self, cap: usize) -> Self

Cap how many in-flight DispatchResult::Async commands the engine will hold at once.

Source

pub fn without_max_pending_async(self) -> Self

Disable the pending-async cap - the engine accepts any number of in-flight commands.

Source

pub fn with_max_outbound_queue(self, cap: usize) -> Self

Cap the outbound envelope queue depth.

Source

pub fn without_max_outbound_queue(self) -> Self

Disable the outbound queue cap.

Source

pub fn with_bus_capacity(self, capacity: usize) -> Self

Override the bus capacity (default DEFAULT_BUS_CAPACITY).

Source

pub fn with_per_hop_budget_ns(self, budget_ns: u64) -> Self

Override the per-target-boundary budget in nanoseconds (default DEFAULT_PER_HOP_BUDGET_NS). Deployments with known-slow links can dial this up; tightly-coupled deployments can dial it down.

Source

pub fn with_backpressure_high_water_pct(self, pct: u8) -> Self

Override the receiver-side back-pressure high-water mark percentage (default DEFAULT_HIGH_WATER_PCT). Clamped to 1..=100 by the BackpressureTracker constructor.

Source

pub fn with_backpressure_k_before_silent(self, k: u32) -> Self

Override K (notices-without-recovery before silent-drop; default DEFAULT_K_BEFORE_SILENT). Clamped to at least 1 by the BackpressureTracker constructor.

Source

pub fn with_backpressure_min_notice_interval_ns(self, interval_ns: u64) -> Self

Override the minimum interval between successive notices to the same peer (default DEFAULT_MIN_NOTICE_INTERVAL_NS). Clamped to at least 1 by the BackpressureTracker constructor.

Source

pub fn with_ingress_byte_budget(self, bytes: usize) -> Self

Override the cumulative ingress byte budget.

Source

pub fn with_max_app_event_bytes(self, bytes: usize) -> Self

Override the per-AppEvent payload cap.

Source

pub fn with_max_invoke_inputs(self, count: usize) -> Self

Override the per-Invoke input-count cap.

Source

pub fn with_max_invoke_bytes(self, bytes: usize) -> Self

Override the per-Invoke cumulative payload cap.

Source

pub fn with_max_completion_result_bytes(self, bytes: usize) -> Self

Override the per-CompletionHandle result cap.

Trait Implementations§

Source§

impl Clone for NodeConfig

Source§

fn clone(&self) -> NodeConfig

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 NodeConfig

Source§

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

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

impl From<&NodeConfig> for NodeConfigSnapshot

Source§

fn from(c: &NodeConfig) -> Self

Converts to this type from the input type.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> ErasedComponent for T
where T: Any + Send + Sync,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more