Skip to main content

Crate memlink_shm

Crate memlink_shm 

Source
Expand description

Shared memory IPC system with multi-priority message queues, futex signaling, and cross-platform support (Linux, macOS, Windows). Provides daemon-client architecture with crash recovery, bounds checking, and backpressure control.

Re-exports§

pub use platform::Platform;
pub use mmap::MmapSegment;
pub use control::ControlRegion;
pub use layout::CONTROL_REGION_SIZE;
pub use layout::RING_BUFFER_OFFSET;
pub use layout::MIN_SEGMENT_SIZE;
pub use layout::DEFAULT_SEGMENT_SIZE;
pub use layout::MAX_SEGMENT_SIZE;
pub use layout::PAGE_SIZE;
pub use buffer::RingBuffer;
pub use buffer::RingBufferError;
pub use buffer::SlotId;
pub use buffer::Priority as BufferPriority;
pub use buffer::MAX_SLOT_SIZE;
pub use futex::Futex;
pub use futex::FutexError;
pub use futex::FutexResult;
pub use priority::Priority;
pub use priority::calculate_slot_distribution;
pub use pring::PriorityRingBuffer;
pub use transport::ShmTransport;
pub use transport::NrelayShmTransport;
pub use transport::ShmError;
pub use transport::ShmResult;
pub use recovery::RecoveryManager;
pub use recovery::Heartbeat;
pub use recovery::SlotMetadata;
pub use recovery::SlotState;
pub use safety::BoundsChecker;
pub use safety::PoisonGuard;
pub use safety::PoisonState;
pub use safety::SafeShmAccess;
pub use safety::BoundsError;
pub use safety::SafeAccessError;

Modules§

buffer
Lock-free single-producer single-consumer (SPSC) ring buffer. Provides atomic slot state management with cache-line aligned slots.
control
Control region for shared memory coordination between daemon and clients. Contains head/tail pointers, sequence numbers, futex words, and state flags.
futex
Cross-platform futex (fast userspace mutex) for efficient wait/wake signaling. Uses native syscalls: Linux futex, macOS ulock, Windows WaitOnAddress.
layout
Memory layout constants for shared memory segment structure. Control region at offset 0 (4KB), ring buffer follows.
mmap
Cross-platform memory-mapped file abstraction with unified MmapSegment enum.
platform
Platform detection for selecting OS-specific implementations at compile time.
pring
Multi-priority ring buffer with three-tier message queuing. Critical (20%), High (50%), Low (30%) slot distribution with FIFO ordering.
priority
Three-tier priority system for message classification and routing. Critical (20%), High (50%), Low (30%) slot distribution.
recovery
Crash recovery, stale slot cleanup, and daemon liveness monitoring. Uses slot state machine, timestamps, heartbeats, and PID files.
safety
Memory safety utilities: bounds checking, panic guards, and safe access wrappers.
transport
High-level shared memory transport trait with daemon-client architecture. Provides priority-based messaging, futex signaling, and connection management.