Key Value Document Store (KVDS)
An efficient key-value store for encoding documents.
Features
KVDS is a format for encoding key-value lists where the key is a single u8
and the value is an array (called a Vec
in Rust) of u8
.
- There can be multiple values for one key, i.e. there can be more than one of the same key
- The key-value pairs are kept in order
- KVDS uses an efficient encoding mechanism
- KVDS does not have a built-in way of dealing with nesting; however, given that encoded KVDS is a
Vec<u8>
, and values are alsoVec<u8>
, nesting is not hard to implement on a case-by-case basis - KVDS is meant for encoding documents, much like XML
Usage
This crate, KVDS, is meant to be used as a Rust library. See the basic example for more information.
A note about storing Strings
One of the most common types of data held in the value field is a string. In Rust, a Vec<u8>
can be converted to a String
as follows:
String from;
The String
can be converted back as follows:
STRING.as_bytes.to_vec;
Saving to a file
The process of saving to a file is currently pretty complicated. It is detailed in the files example.
Size limits
Keys can only be one byte. There are therefore 256 distinct keys.
Values can be up to 18.4 exabytes. Needless to say, there are many, many unique combinations.
(AFAIK, 18.4 exabytes is also the theoretical limit for RAM in 64-bit CPUs).
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.