walrus_rust/
lib.rs

1//! # Walrus 🦭
2//!
3//! A high-performance Write-Ahead Log (WAL) implementation in Rust designed for concurrent 
4//! workloads
5//!
6//! ## Quick Start
7//!
8//! ```rust
9//! use walrus_rust::{Walrus, ReadConsistency};
10//!
11//! # fn main() -> std::io::Result<()> {
12//! // Create a new WAL instance
13//! let wal = Walrus::new()?;
14//!
15//! // Write data to a topic
16//! wal.append_for_topic("my-topic", b"Hello, Walrus!")?;
17//!
18//! // Read data from the topic
19//! if let Some(entry) = wal.read_next("my-topic")? {
20//!     println!("Read: {:?}", String::from_utf8_lossy(&entry.data));
21//! }
22//! # Ok(())
23//! # }
24//! ```
25//!
26//! ## Configuration
27//!
28//! Walrus supports different consistency models:
29//!
30//! ```rust
31//! use walrus_rust::{Walrus, ReadConsistency, FsyncSchedule};
32//!
33//! # fn main() -> std::io::Result<()> {
34//! // Strict consistency - every read is persisted
35//! let wal = Walrus::with_consistency(ReadConsistency::StrictlyAtOnce)?;
36//!
37//! // At-least-once delivery - persist every N reads
38//! let wal = Walrus::with_consistency(
39//!     ReadConsistency::AtLeastOnce { persist_every: 1000 }
40//! )?;
41//!
42//! // Full configuration control
43//! let wal = Walrus::with_consistency_and_schedule(
44//!     ReadConsistency::AtLeastOnce { persist_every: 1000 },
45//!     FsyncSchedule::Milliseconds(500)
46//! )?;
47//! # Ok(())
48//! # }
49//! ```
50
51#![recursion_limit = "256"]
52pub mod wal;
53pub use wal::{Entry, ReadConsistency, FsyncSchedule, Walrus};