byteor_transport_shm/lib.rs
1#![deny(missing_docs)]
2#![deny(unreachable_pub, rust_2018_idioms)]
3// This crate necessarily uses `unsafe` for:
4// - mapping shared memory (`mmap`) via `memmap2`
5// - creating typed raw pointers into that mapping
6// - overlaying ABI atomics onto `std::sync::atomic` for initialization handshake
7//
8// The public API avoids handing out `&mut` references to the mapping.
9
10//! Shared-memory transport utilities (open/create/validate).
11//!
12//! This crate will own OS-facing mapping logic and treat SHM as untrusted input.
13//!
14//! ## Crash / cleanup semantics
15//!
16//! Regions are file-backed mappings. If a process crashes, the backing file may remain on disk.
17//! Subsequent openers will:
18//! - validate layout compatibility once initialization is complete
19//! - **wait for a bounded time** if the mapping is observed in an "initializing" state
20//! - fail closed with `Error::Layout(indexbus_core::Error::NotInitialized)` if initialization
21//! does not complete (e.g. the initializing process crashed)
22//!
23//! Best-effort cleanup is performed by callers (tests/benches remove their temp files). Operator
24//! tooling may also remove stale mapping files as needed.
25
26mod error;
27mod init;
28mod internal;
29mod mapping;
30mod options;
31mod regions;
32mod util;
33
34pub use error::Error;
35pub use mapping::MappingInfo;
36pub use options::OpenOptions;
37pub use regions::{EventsChainRegion, SequencedSlotsRegion};
38
39#[cfg(test)]
40mod tests;