com
commitlog
cargo install commitlog
com

commitlog

Append-only commit log library for Rust

by Zack Owens

0.1.2 (see all)License:MIT
cargo install commitlog
Readme

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.

Crates.io Docs.rs Travis

Documentation

Usage

First, add this to your Cargo.toml:

[dependencies]
commitlog = "0.1"


extern crate commitlog;

use commitlog::*;

fn main() {
    // open a directory called 'log' for segment and index storage
    let opts = LogOptions::new("log");
    let mut log = CommitLog::new(opts).unwrap();

    // append to the log
    log.append("hello world").unwrap(); // offset 0
    log.append("second message").unwrap(); // offset 1

    // read the messages
    let messages = log.read(0, ReadLimit::default()).unwrap();
    for msg in messages.iter() {
        println!("{} - {}", msg.offset(), String::from_utf8_lossy(msg.payload()));
    }

    // prints:
    //    0 - hello world
    //    1 - second message
}

Prior Art

GitHub Stars

68

LAST COMMIT

8mos ago

MAINTAINERS

1

CONTRIBUTORS

6

OPEN ISSUES

6

OPEN PRs

2
VersionTagPublished
0.1.2
2yrs ago
0.1.1
3yrs ago
0.1.0
4yrs ago
0.0.10
4yrs ago
No alternatives found
No tutorials found
Add a tutorial