How bloomdb-labs/buffer_ring works
Buffer Ring is a Rust library that stages concurrent writes in aligned buffers and dispatches sealed buffers to storage through io_uring. The principal workflow is caller → ring reservation and buffer write → sealing/rotation → optional flush → asynchronous completion and buffer reuse. Manual flushing, completion notifications, and parallel or serialized write modes are additional capabilities. The graph follows README statements and shown excerpts; some implementation details, especially unsampled code, are not inferred.
Main entry points: ring.rs Buffer Ring · flush_buffer.rs Flush Buffer · quik_io.rs QuikIO Modes · lib.rs Aligned Buffer Memory
Components 12
Write Staging
- Buffer Ring
src/ring.rs - Flush Buffer
src/flush_buffer.rs - Aligned Buffer Memory
src/lib.rs - Packed Atomic State
src/state.rs - Rotation and Addressing
src/ring.rs
I/O Dispatch
- Flush Dispatch
src/ring.rs - QuikIO Modes
src/quik_io.rs - io_uring
- Backing File
Completion
- Completion Handling
src/ring.rs - Completion Receiver
src/ring.rs
Other components
- Storage Client
Connections 15
- Storage Client → Buffer Ring: writes through
README.md - Buffer Ring → Flush Buffer: reserves and writes
src/ring.rs - Flush Buffer → Aligned Buffer Memory: stores payload
src/flush_buffer.rs - Flush Buffer → Packed Atomic State: updates atomically
src/flush_buffer.rs - Buffer Ring → Rotation and Addressing: seals and rotates
src/ring.rs - Buffer Ring → Flush Dispatch: flushes when enabled
src/ring.rs - Storage Client → Flush Dispatch: may flush manually
README.md - Flush Dispatch → QuikIO Modes: dispatches buffer
src/ring.rs - QuikIO Modes → io_uring: submits writes
src/quik_io.rs - io_uring → Backing File: writes asynchronously
README.md - QuikIO Modes → Backing File: reads and syncs
src/quik_io.rs - Buffer Ring → Completion Handling: checks completions
src/ring.rs - Completion Handling → QuikIO Modes: retries failed writes
src/ring.rs - Completion Handling → Flush Buffer: resets on success
src/ring.rs - Completion Handling → Completion Receiver: sends written ranges
src/ring.rs