• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..15-Mar-2021-

examples/H15-Mar-2021-272199

src/H15-Mar-2021-4,1452,836

tests/H15-Mar-2021-311205

.cargo-checksum.jsonH A D15-Mar-20212.4 KiB11

CODE_OF_CONDUCT.mdH A D15-Mar-2021691 1611

Cargo.lockH A D15-Mar-202110.6 KiB419371

Cargo.tomlH A D15-Mar-20211.8 KiB7661

LICENSEH A D15-Mar-202111.1 KiB203169

README.mdH A D15-Mar-20215.2 KiB9255

run-all-examples.shH A D15-Mar-2021264 1510

README.md

1# rkv
2
3[![Travis CI Build Status](https://travis-ci.org/mozilla/rkv.svg?branch=master)](https://travis-ci.org/mozilla/rkv)
4[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/lk936u5y5bi6qafb/branch/master?svg=true)](https://ci.appveyor.com/project/mykmelez/rkv/branch/master)
5[![Documentation](https://docs.rs/rkv/badge.svg)](https://docs.rs/rkv/)
6[![Crate](https://img.shields.io/crates/v/rkv.svg)](https://crates.io/crates/rkv)
7
8The [rkv Rust crate](https://crates.io/crates/rkv) is a simple, humane, typed key-value storage solution. It supports multiple backend engines with varying guarantees, such as [LMDB](http://www.lmdb.tech/doc/) for performance, or "SafeMode" for reliability.
9
10This master branch only supports the LMDB backend. We're looking into supporting multiple backends, starting with "SafeMode" in the [feature branch](https://github.com/mozilla/rkv/tree/safe-mode).
11
12## ⚠️ Warning ⚠️
13
14The LMDB backend is currently unstable and crash-prone. We're attempting to fix these crashes in bugs [1538539](https://bugzilla.mozilla.org/show_bug.cgi?id=1538539), [1538541](https://bugzilla.mozilla.org/show_bug.cgi?id=1538541) and [1550174](https://bugzilla.mozilla.org/show_bug.cgi?id=1550174).
15
16To use rkv in production/release environments at Mozilla, you may do so with the "SafeMode" backend, for example:
17
18```toml
19rkv = { git = "https://github.com/mozilla/rkv", branch="safe-mode", default-features = false }
20```
21
22```rust
23use rkv::{Manager, Rkv};
24use rkv::backend::{SafeMode, SafeModeEnvironment};
25
26let mut manager = Manager::<SafeModeEnvironment>::singleton().write().unwrap();
27let shared_rkv = manager.get_or_create(path, Rkv::new::<SafeMode>).unwrap();
28
29...
30```
31
32Instead of a branch, we suggest using a specific `rev` instead. For example, `4a1cc23906865626fa715fd99d98620169d3fd7b` is the latest stable version for "safe-mode".
33
34The "SafeMode` backend performs well, with two caveats: the entire database is stored in memory, and write transactions are synchronously written to disk on commit.
35
36In the future, it will be advisable to switch to a different backend with better performance guarantees. We're working on either fixing the LMDB crashes, or offering more choices of backend engines (e.g. SQLite).
37
38## Use
39
40Comprehensive information about using rkv is available in its [online documentation](https://docs.rs/rkv/), which can also be generated for local consumption:
41
42```sh
43cargo doc --open
44```
45
46## Build
47
48Build this project as you would build other Rust crates:
49
50```sh
51cargo build
52```
53
54### Features
55
56There are several features that you can opt-in and out of when using rkv:
57
58By default, `db-dup-sort` and `db-int-key` features offer high level database APIs which allow multiple values per key, and optimizations around integer-based keys respectively. Opt out of these default features when specifying the rkv dependency in your Cargo.toml file to disable them; doing so avoids a certain amount of overhead required to support them.
59
60If you specify the `backtrace` feature, backtraces will be enabled in "failure"
61errors. This feature is disabled by default.
62
63To aid fuzzing efforts, `with-asan`, `with-fuzzer`, and `with-fuzzer-no-link` configure the build scripts responsible with compiling the underlying backing engines (e.g. LMDB) to build with these LLMV features enabled. Please refer to the official LLVM/Clang documentation on them for more informatiuon. These features are also disabled by default.
64
65## Test
66
67Test this project as you would test other Rust crates:
68
69```sh
70cargo test
71```
72
73The project includes unit and doc tests embedded in the `src/` files, integration tests in the `tests/` subdirectory, and usage examples in the `examples/` subdirectory. To ensure your changes don't break examples, also run them via the run-all-examples.sh shell script:
74
75```sh
76./run-all-examples.sh
77```
78
79Note: the test fixtures in the `tests/envs/` subdirectory aren't included in the package published to crates.io, so you must clone this repository in order to run the tests that depend on those fixtures or use the `rand` and `dump` executables to recreate them.
80
81## Contribute
82
83Of the various open source archetypes described in [A Framework for Purposeful Open Source](https://medium.com/mozilla-open-innovation/whats-your-open-source-strategy-here-are-10-answers-383221b3f9d3), the rkv project most closely resembles the Specialty Library, and we welcome contributions. Please report problems or ask questions using this repo's GitHub [issue tracker](https://github.com/mozilla/rkv/issues) and submit [pull requests](https://github.com/mozilla/rkv/pulls) for code and documentation changes.
84
85rkv relies on the latest [rustfmt](https://github.com/rust-lang-nursery/rustfmt) for code formatting, so please make sure your pull request passes the rustfmt before submitting it for review. See rustfmt's [quick start](https://github.com/rust-lang-nursery/rustfmt#quick-start) for installation details.
86
87We follow Mozilla's [Community Participation Guidelines](https://www.mozilla.org/en-US/about/governance/policies/participation/) while contributing to this project.
88
89## License
90
91The rkv source code is licensed under the Apache License, Version 2.0, as described in the [LICENSE](https://github.com/mozilla/rkv/blob/master/LICENSE) file.
92