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: PeerIdLocal 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: usizeBus capacity. Overflow drops the oldest event + bumps a counter.
per_hop_budget_ns: u64Per-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: EnvelopeCapsinbound 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: u8Receiver-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: u32K = 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: u64Minimum 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: usizeTotal 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: usizePer-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: usizePer-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: usizePer-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: usizePer-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
impl NodeConfig
Sourcepub fn new(peer_id: PeerId) -> Self
pub fn new(peer_id: PeerId) -> Self
Construct with the given local peer identity and production-conservative defaults for every other field.
Sourcepub fn new_edge(peer_id: PeerId) -> Self
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).
Sourcepub fn with_envelope_caps(self, caps: EnvelopeCaps) -> Self
pub fn with_envelope_caps(self, caps: EnvelopeCaps) -> Self
Override the inbound envelope decode caps.
Sourcepub fn with_cycle_op_budget(self, budget: usize) -> Self
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.
Sourcepub fn without_cycle_op_budget(self) -> Self
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.
Sourcepub fn with_max_pending_async(self, cap: usize) -> Self
pub fn with_max_pending_async(self, cap: usize) -> Self
Cap how many in-flight DispatchResult::Async commands the
engine will hold at once.
Sourcepub fn without_max_pending_async(self) -> Self
pub fn without_max_pending_async(self) -> Self
Disable the pending-async cap - the engine accepts any number of in-flight commands.
Sourcepub fn with_max_outbound_queue(self, cap: usize) -> Self
pub fn with_max_outbound_queue(self, cap: usize) -> Self
Cap the outbound envelope queue depth.
Sourcepub fn without_max_outbound_queue(self) -> Self
pub fn without_max_outbound_queue(self) -> Self
Disable the outbound queue cap.
Sourcepub fn with_bus_capacity(self, capacity: usize) -> Self
pub fn with_bus_capacity(self, capacity: usize) -> Self
Override the bus capacity (default
DEFAULT_BUS_CAPACITY).
Sourcepub fn with_per_hop_budget_ns(self, budget_ns: u64) -> Self
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.
Sourcepub fn with_backpressure_high_water_pct(self, pct: u8) -> Self
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.
Sourcepub fn with_backpressure_k_before_silent(self, k: u32) -> Self
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.
Sourcepub fn with_backpressure_min_notice_interval_ns(self, interval_ns: u64) -> Self
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.
Sourcepub fn with_ingress_byte_budget(self, bytes: usize) -> Self
pub fn with_ingress_byte_budget(self, bytes: usize) -> Self
Override the cumulative ingress byte budget.
Sourcepub fn with_max_app_event_bytes(self, bytes: usize) -> Self
pub fn with_max_app_event_bytes(self, bytes: usize) -> Self
Override the per-AppEvent payload cap.
Sourcepub fn with_max_invoke_inputs(self, count: usize) -> Self
pub fn with_max_invoke_inputs(self, count: usize) -> Self
Override the per-Invoke input-count cap.
Sourcepub fn with_max_invoke_bytes(self, bytes: usize) -> Self
pub fn with_max_invoke_bytes(self, bytes: usize) -> Self
Override the per-Invoke cumulative payload cap.
Sourcepub fn with_max_completion_result_bytes(self, bytes: usize) -> Self
pub fn with_max_completion_result_bytes(self, bytes: usize) -> Self
Override the per-CompletionHandle result cap.
Trait Implementations§
Source§impl Clone for NodeConfig
impl Clone for NodeConfig
Source§fn clone(&self) -> NodeConfig
fn clone(&self) -> NodeConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NodeConfig
impl Debug for NodeConfig
Source§impl From<&NodeConfig> for NodeConfigSnapshot
impl From<&NodeConfig> for NodeConfigSnapshot
Source§fn from(c: &NodeConfig) -> Self
fn from(c: &NodeConfig) -> Self
Auto Trait Implementations§
impl Freeze for NodeConfig
impl RefUnwindSafe for NodeConfig
impl Send for NodeConfig
impl Sync for NodeConfig
impl Unpin for NodeConfig
impl UnsafeUnpin for NodeConfig
impl UnwindSafe for NodeConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedComponent for T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request