Expand description
Framework primitives bundled into every RuntimeResourceRef.
Framework primitives bundled into every RuntimeResourceRef.
9 framework primitives the engine bundles into the
RuntimeResourceRef for every dispatch_atomic call per
docs/ENGINE.md §10 + docs/internal/IMPLEMENTATION_PLAN.md //! lines 770-779.
ships real impls for Scheduler / PeerGate / RequestTracker + adds 3 new primitives (serialize_queue / hold_table / record_buffer). Other primitives stay minimal until
Modules§
- address_
book AddressBook- globalPeerId → (Vec<Address>, ref_count)registry perENGINE.md§10.5 +docs/ADDRESSING.md.- backoff_
table BackoffTable- per-peer exponential backoff state used by wire syscalls + transport adapters per ENGINE.md §10.2.- backpressure_
notice BackoffNoticePayload- typed wire payload for the backpressure protocol perdocs/internal/superpowers/specs/2026-06-23-backpressure-runtime.md§2.- backpressure_
tracker BackpressureTracker- per-peer receiver-side state for the typed-overload-signal protocol perdocs/internal/superpowers/specs/2026-06-23-backpressure-runtime.md.- event_
source EventSource- registeredevent_kind → ComponentTagsubscription table consulted by the engine’s Phase 3 bus event routing per ENGINE.md §10.7.- hold_
table HoldTable- slot-named value buffer forHold.Stash/Hold.Flushsyscalls.- inbound_
dedup InboundDedup- sliding-window seen-message tracker per ENGINE.md §10.4.- outbound_
queue OutboundQueue- FIFO of wire envelopes ready to ship.- peer_
gate PeerGate- per-name concurrency limiter used byLimit.Acquire/Limit.Releasesyscalls.- peer_
governor PeerGovernor- the single source of truth for peer policy and health tracking per .- peer_
state PeerState— the framework’s consolidated per-peer state.- record_
buffer RecordBuffer- bounded per-name ring buffer used by theRecordsyscall.- request_
tracker RequestTracker- mint correlation tokens forCorrelateTagand track in-flight wire requests.- rng
RngU64Source- pluggable u64 RNG used by theRngU64syscall op. Default impl wrapsgetrandom.- rtt_
tracker - for adaptive deadlines on every wire round-trip.
- scheduler
Scheduler- sorted timer heap.- serialize_
queue SerializeQueue- named-FIFO map forSerialize.Enqueue/Serialize.Dequeuesyscalls.
Structs§
- Address
- Multiaddr - a sequence of typed
Protocolsegments describing a delivery path. Perdocs/ADDRESSING.md, this is BB’s canonical address type: the suffix segments tell the receiver where to route inside its own node, so no per-message-type or per-endpoint-id lookup tables are needed. - Address
Book - Ref-counted
PeerId → Vec<Address>registry. Single source of truth for “where can I reach this peer.” - Backoff
Notice Payload - Wire-encoded BackoffNotice payload.
- Backoff
Table - Per-peer exponential backoff table.
- Backpressure
Entry - Per-peer back-pressure bookkeeping.
- Backpressure
Tracker - Per-peer receiver-side back-pressure state.
- Counter
Rng - Deterministic counter RNG for tests.
- Event
Source event_kind → Vec<ComponentTag>subscription table.- Framework
Components docs/ENGINE.md§3 bundle of framework primitives. Split-borrowed into eachdispatch_atomiccall’sRuntimeResourceRef.- Getrandom
U64 - Default
getrandom-backed RNG. - Hold
Table - Named-slot value buffer with bounded distinct-slot count.
- Inbound
Context - Per-
ExecIdcontext captured at inbound envelope delivery. Replaces the four parallelenvelope_*HashMaps with one struct of optional fields. Components access this throughRuntimeResourceRef::inbound. - Inbound
Dedup - Sliding-window seen-message tracker.
- Outbound
Queue - FIFO of wire envelopes ready to ship.
- Peer
Gate - Per-name concurrency limiter.
- Peer
Governor - Per-peer policy + health state owner.
- Peer
Health - Per-peer health snapshot. Read by
Node::peer_health()for operator introspection. - Peer
State - Consolidated per-peer state.
- Record
Buffer - Per-name ring buffer with two bounds.
- Request
Tracker - Monotonically-increasing token minter + in-flight tracker.
- Scheduler
- Sorted timer heap.
- Serialize
Queue - Named-FIFO map with per-queue bounded capacity.
Enums§
- Address
Book Error - Errors surfaced by
AddressBookmutation methods. - Address
Error - Decode errors surfaced by
Address::from_bytesandAddress::parse_str. - Backoff
Cause - Why the receiver is requesting a back-off.
- Backoff
Cause Wire - Wire-stable encoding of
BackoffCause. Serialized as a u8 so the on-wire representation never bit-shifts when the framework enum evolves. Always derived from the framework enum at the send site + mapped back at the receive site. - Backpressure
Decision - Decision returned by
BackpressureTracker::observe_overload. - Block
Reason - Why a peer can’t receive an envelope, surfaced both inbound (drop) and outbound (gate failure).
- Decision
- Outcome of a
check_inbound/check_outboundconsultation. - Lifecycle
Transition - Side-effect of recording a failure or success - the engine
translates these into
EngineStepvariants in Phase 8. - Protocol
- One typed protocol segment in an
Addressmultiaddr. Each variant maps to a stable BB-specific multiaddr code in the 0xE1-0xEF range (P2preuses the libp2p code 0x55 since it carries the BBPeerIdidentity that crosses transport adapters). The binary encoding iscode (u8) || payloadwhere the payload’s length is fixed for every variant exceptOp(which is length-prefixed). - Timer
Kind - What a matured timer signals covers Sleep / Interval / After / Completion.
Constants§
- BACKPRESSURE_
DOMAIN - Domain string the framework uses to namespace the backpressure
protocol per
bb-runtime/src/bus.rs:155reserved framework prefix. Surfaced for cross-referencing in docs + tests; the actual routing key is the per-filltype_hashfrombackoff_notice_type_hash. - DEFAULT_
FAILURE_ THRESHOLD - Default number of consecutive
wire::Sendfailures before a peer is marked as down.PeerGovernor::record_failureemits the lifecycle transition; the engine’s Phase 8 surfaces it asEngineStep::PeerDown. - DEFAULT_
HIGH_ WATER_ PCT - Default high-water mark percentage. Matches the spec default
in §6: ingress queue depth >= 75% of capacity triggers a
BackoffCause::QueueFullnotice. - DEFAULT_
K_ BEFORE_ SILENT - Default K (notices-without-slowdown before silent-drop).
Matches
RttEma::is_warm’s “evidence sufficient to act” threshold of 3 samples perbb-runtime/src/framework/rtt_tracker.rs:126-128. - DEFAULT_
MIN_ NOTICE_ INTERVAL_ NS - Default minimum interval between successive notices to the
same peer (1 second). 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 second even when
the receiver lacks a tighter per-cause
min_backoff_nshint.
Traits§
- RngU64
Source - Source of
u64random values. Trait so tests can supply a deterministic counter via a different impl.
Functions§
- backoff_
notice_ type_ hash - Stable u64 discriminator for
BackoffNoticePayload. Matches the canonicalSlotFill.type_hashthe framework stamps at send time and consults at receive time perbb-ir/src/slot_value.rs:203-210. - build_
backoff_ notice_ envelope - Build a
BackoffNoticewire envelope addressed tosender.
Type Aliases§
- Multiaddress
- Public DSL alias - the chosen name for
Addresson the graph surface. The internal type isframework::Address; the alias keeps user-facing code (Output<Multiaddress>,Multiaddressconstants) reading naturally without introducing a second type.