• Stars
    star
    176
  • Rank 216,317 (Top 5 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rust leveldb bindings

Almost-complete bindings for leveldb for Rust.

Documentation

Rust version policy

leveldb is built and tested on stable releases of Rust. This are currently 1.31.0 and 1.43.1. Nightlies might not build at any point and failures are allowed. There are no known issues with nightlies, though.

Prerequisites

snappy and leveldb need to be installed. On Ubuntu, I recommend:

sudo apt-get install libleveldb-dev libsnappy-dev

Usage

If your project is using Cargo, drop the following lines in your Cargo.toml:

[dependencies]

leveldb = "0.8"

Development

Make sure you have all prerequisites installed. Run

$ cargo build

for building and

$ cargo test

to run the test suite.

Examples

extern crate tempdir;
extern crate leveldb;

use tempdir::TempDir;
use leveldb::database::Database;
use leveldb::iterator::Iterable;
use leveldb::kv::KV;
use leveldb::options::{Options,WriteOptions,ReadOptions};

fn main() {
  let tempdir = TempDir::new("demo").unwrap();
  let path = tempdir.path();

  let mut options = Options::new();
  options.create_if_missing = true;
  let mut database = match Database::open(path, options) {
      Ok(db) => { db },
      Err(e) => { panic!("failed to open database: {:?}", e) }
  };

  let write_opts = WriteOptions::new();
  match database.put(write_opts, 1, &[1]) {
      Ok(_) => { () },
      Err(e) => { panic!("failed to write to database: {:?}", e) }
  };

  let read_opts = ReadOptions::new();
  let res = database.get(read_opts, 1);

  match res {
    Ok(data) => {
      assert!(data.is_some());
      assert_eq!(data, Some(vec![1]));
    }
    Err(e) => { panic!("failed reading data: {:?}", e) }
  }

  let read_opts = ReadOptions::new();
  let mut iter = database.iter(read_opts);
  let entry = iter.next();
  assert_eq!(
    entry,
    Some((1, vec![1]))
  );
}

Open issues

  • Filter policies are missing
  • Iterators with arbirary start and end points are unsupported

License

MIT, see LICENSE

More Repositories

1

rbtree

RB-Trees for Ruby - originally by OZAWA Takuma
C
51
star
2

widmann

Rust
46
star
3

rust-in-an-hour

26
star
4

mailbox

Rust
26
star
5

sl-rust

sl(1). In Rust.
Rust
23
star
6

lazers

A couchdb client in Rust
Rust
18
star
7

attr

Rust
18
star
8

ffi-opaque

A simple macro to create correct opaque pointers
Rust
16
star
9

panic_at_the_disco

Rust
15
star
10

readrust-cli

Rust
14
star
11

tsung-stats-server

A small sinatra app to generate and serve Tsung logs
Ruby
9
star
12

talaria

The flying shoes of hermes
Ruby
8
star
13

yakshav.es

HTML
8
star
14

escapade

Rust
7
star
15

leveldb-sys

Rust
7
star
16

futures-poll-log

Rust
6
star
17

rust-couchdb

Rust
6
star
18

bisschen

A client for notmuch, written in Rust
Rust
5
star
19

yaks

Rust
5
star
20

rustfest-async-std

5
star
21

tbd-again

Rust
5
star
22

scrapy-elasticsearch-bulk-item-exporter

A scrapy feed exporter that exports to elasticsearch bulk format. Very handy for development.
Python
5
star
23

eljojo

Ruby
4
star
24

french-people

4
star
25

multi_def

A small library providing method definitions with pattern matching
Ruby
4
star
26

cute

Rust
4
star
27

rust-terminal

Rust
4
star
28

knob

Knob is a simple library to manage settings in Rust
Rust
3
star
29

elasticonsole

Ruby
3
star
30

async-chat-template

Rust
3
star
31

wilson

Wilson documents Sinatra
Ruby
3
star
32

staying-alive

Learning futures with the Bee Gees
3
star
33

hyper-http-proxy

Rust
2
star
34

rustfest-book

2
star
35

virtus-cycles

A cycle detector for virtus.
Ruby
2
star
36

the-memory-is-hot-lava

Rust
2
star
37

elastictrope

Ruby
2
star
38

virtus-representable

Generate representable stuff quickly out of virtus models
Ruby
2
star
39

rust-calendar

Ruby
2
star
40

padrino-ground-up

Padrino - from the ground up
Ruby
2
star
41

hyper-server

Rust
2
star
42

drossel

Rust
1
star
43

www.rust-lang.org-i18n

FreeMarker
1
star
44

aoc2021

My Advent of Code 2021 solutions
Ada
1
star
45

imdb-parser

Haskell
1
star
46

drossel-server

Rust
1
star
47

vimux-es

Vim Script
1
star
48

libtsm

C
1
star
49

loli

A minimum web dev DSL in Haskell
Haskell
1
star
50

redisish

Rust
1
star
51

home-flo.andersground.net

JavaScript
1
star
52

state-led

Rust
1
star
53

schlick

Schlick is a MUD you want to travel to
Rust
1
star
54

middleman-file-history

Ruby
1
star
55

language_tool-jars

Perl
1
star
56

accu-client

Rust
1
star
57

yard-test

Some games with dynamic Documentation generation
Ruby
1
star
58

mailbox-konstanz

Rust
1
star
59

m29

Rust
1
star
60

air-to-youtube

Python
1
star
61

actixtagram

Rust
1
star