1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! In-process log with Kafka-like semantics for Rust.
//!
//! kafko exists for use cases where your data never needs to leave the
//! process: embedded event sourcing, edge buffers, durable in-process
//! pub/sub, deterministic integration tests without Docker or a broker,
//! single-binary services that want a real log instead of a `VecDeque<T>`
//! under a mutex.
//!
//! # Quickstart
//!
//! ```no_run
//! use bytes::Bytes;
//! use kafko::Kafko;
//!
//! #[tokio::main]
//! async fn main() -> kafko::Result<()> {
//! let broker = Kafko::open("./data").await?;
//! broker.create_topic("orders").await?;
//!
//! // Produce
//! let producer = broker.producer_for("orders").await?;
//! let offset = producer.send(None, Bytes::from("order-1")).await?;
//! println!("appended at offset {offset}");
//!
//! // Consume from the beginning
//! let mut consumer = broker.consumer_for("orders").await?;
//! consumer.seek(0);
//! let record = consumer.next_record().await?;
//! println!("read: {:?}", record.value());
//!
//! broker.shutdown().await?;
//! Ok(())
//! }
//! ```
//!
//! # Durability
//!
//! `Producer::send().await` resolves once the record is in the OS file
//! (page cache) — the same contract as Kafka `acks=1`. Records survive
//! process crashes (panic, SIGKILL, OOM) but may be lost on OS panic or
//! power loss until the kernel writes back. Call [`Kafko::shutdown`] for
//! a hard durability boundary, or [`Partition::sync`] for mid-life fsync.
//!
//! The recovery path on next `Kafko::open` CRC-scans the active segment
//! and truncates any torn writes at the tail.
//!
//! See the [project README](https://github.com/Vadimus1983/kafko) for
//! benchmarks, the full architecture diagram, and the v0.2 roadmap.
pub use Kafko;
pub use Compression;
pub use Consumer;
pub use ;
pub use ;
pub use Partition;
pub use Producer;
pub use Record;
pub use Segment;
pub use SparseIndex;