Expand description
Blocking (Tier B) adapters over indexbus-core using indexbus-wake.
This crate keeps indexbus-core bytes-first and nonblocking, and provides optional
std-only blocking wrappers that use the appended wake sections in the v1 ABI.
§Feature requirements
- This crate is std-only (
stdis the default and only meaningful feature). - Blocking semantics require layouts/mappings that include wake sections.
§Contracts
- Blocking operations park the current thread (directly or indirectly) until progress is possible, and are intended for Tier B integrations.
- Wake-backed adapters must not busy-spin while idle; they rely on
indexbus-wake. - On wake-capable mappings, blocking send/recv are expected to be fair with respect to other waiters.
§Error semantics
- Constructor helpers return
Error::MissingBlockingCapabilitywhen wake sections are required but not present. - Layout validation failures from
indexbus-coreare propagated.
§When wake sections are absent
Blocking adapters require both:
INDEXBUS_CAP_SUPPORTS_BLOCKINGin the layout header, and- an appended wake section at the next 64B boundary (as validated by
indexbus-core).
If either requirement is not met, constructors like split_spsc_blocking and
fanout_handles_blocking return an error (Error::MissingBlockingCapability or a core layout
validation error).
Fallback: use the nonblocking handles from indexbus-core (and/or indexbus-route) and
drive progress via a polling loop appropriate to your application (e.g. route_once_with_stats
plus std::thread::yield_now()/sleep/backoff).
§Minimal usage (compile-only)
Blocking adapters require a mapping that includes a v1 wake section. Transports like
indexbus-transport-shm can create such regions.
use indexbus_abi::{caps, layouts::SharedLayout};
use indexbus_blocking::split_spsc_blocking;
use indexbus_core::init_shared_layout_with_layout_bytes;
// SharedLayout is large; allocate it on the heap.
let mut shared: Box<SharedLayout> = Box::new(unsafe { core::mem::zeroed() });
// In a real mapping, `layout_bytes` must include the appended wake section bytes.
init_shared_layout_with_layout_bytes(
&mut shared,
caps::INDEXBUS_CAP_SUPPORTS_EVENTS | caps::INDEXBUS_CAP_SUPPORTS_BLOCKING,
core::mem::size_of::<SharedLayout>() as u32,
);
let _blocking = split_spsc_blocking(&mut shared);Structs§
- Blocking
Fanout Consumer - Blocking wrapper over an
indexbus-corefanout consumer. - Blocking
Fanout Producer - Blocking wrapper over an
indexbus-corefanout producer. - Blocking
Fanout Router - Blocking wrapper over an
indexbus-corefanout router. - Blocking
Fanout Router Ref - Blocking view over an existing
FanoutRouterreference. - Blocking
Mpsc Consumer - Blocking wrapper over an
indexbus-coreMPSC consumer. - Blocking
Mpsc Producer - Blocking wrapper over an
indexbus-coreMPSC producer. - Blocking
Spsc Receiver - Blocking wrapper over an
indexbus-coreSPSC receiver. - Blocking
Spsc Sender - Blocking wrapper over an
indexbus-coreSPSC sender.
Enums§
- Error
- Errors returned by blocking adapters.
Functions§
- fanout_
handles_ blocking - Create wake-backed blocking wrappers for a fanout region.
- fanout_
router_ ref_ blocking - Create a wake-backed blocking view over an existing
FanoutRouter. - split_
mpsc_ blocking - Create wake-backed blocking wrappers for MPSC over a
SharedLayout. - split_
spsc_ blocking - Create wake-backed blocking wrappers for SPSC over a
SharedLayout.
Type Aliases§
- Result
- Convenience
Resulttype for blocking adapters.