<commit_before># Commit Log

Commit log library for rust. It is intended to be used in various higher-level distributed abstractions on top
of a distributed log.

```rust
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(b"hello world").unwrap(); // offset 0
    log.append(b"second message").unwrap(); // offset 1

    // read the messages
    let messages = log.read(ReadPosition::Beginning, ReadLimit::Messages(2)).unwrap();
    for msg in messages {
        println!("{} - {}", msg.offset(), String::from_utf8_lossy(msg.payload()));
    }
<commit_msg>Updating readme<commit_after># Commit Log

Commit log library for rust. It is intended to be used in various higher-level distributed abstractions on top
of a distributed log.

[![Crates.io](https://img.shields.io/crates/v/commitlog.svg?maxAge=2592000)]()

[Documentation](https://docs.rs/commitlog/0.0.1/commitlog/)


## Usage

First, add this to your `Cargo.toml`:

```toml
[dependencies]
commitlog = "0.0.1"
```

```rust
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(b"hello world").unwrap(); // offset 0
    log.append(b"second message").unwrap(); // offset 1

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

{'fraction_non_alphanumeric': 0.150997150997151, 'fraction_numerical': 0.011965811965811967, 'mean_word_length': 3.6578249336870026, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3449818', 'n_tokens_mistral': 555, 'n_tokens_neox': 542, 'n_words': 166}