Key Value Document Store (KVDS)

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. Furthermore, the key-value pairs are kept in order. KVDS is meant for encoding documents, much like XML.

Usage

This crate, KVDS, is meant to be used as a Rust library. See the 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:

rust String::from(std::str::from_utf8(&VEC_U8[..]).unwrap());

The String can be converted back as follows:

rust STRING.as_bytes().to_vec();

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

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.