Commit Log
Sequential, disk-backed commit log library for Rust. The library can be used in various higher-level distributed abstractions on top of a distributed log such as Paxos, Chain Replication or Raft.
Documentation
Usage
First, add this to your Cargo.toml
:
[dependencies]
commitlog = "0.1"
extern crate commitlog;
use commitlog::*;
fn main() {
let opts = LogOptions::new("log");
let mut log = CommitLog::new(opts).unwrap();
log.append("hello world").unwrap(); log.append("second message").unwrap();
let messages = log.read(0, ReadLimit::default()).unwrap();
for msg in messages.iter() {
println!("{} - {}", msg.offset(), String::from_utf8_lossy(msg.payload()));
}
}
Prior Art