neutrondb

Crates.ioneutrondb
lib.rsneutrondb
version6.0.0
sourcesrc
created_at2021-08-26 20:21:24.11607
updated_at2023-10-08 10:16:46.20428
descriptionNeutronDB is a log-structured merge-tree key-value store for any implemented data type.
homepage
repositoryhttps://github.com/stelar-labs/neutrondb-rs
max_upload_size
id442726
size43,544
Roy (royokello)

documentation

README

NeutronDB

NeutronDB is a log-structured merge-tree key-value store for any implemented data type.

Authors

About

Neutron Table Binary Format

  • Version (1 Byte)
  • Key Count (8 Bytes)
  • Index Position (8 Bytes)
  • Keys Position (8 Bytes)
  • Bloom Filter (Dynamic Size)
  • Index Data (Dynamic Size)
  • Keys Data (Dynamic Size)
  • Values Data (Dynamic Size)

Features

  • Key-Value Store with Put, Get & Delete
  • Supports Rust Native Types
  • Supports any Type that implements IntoBytes & TryFromBytes
  • Supports 64bit Data Locations within Tables, Max ~18 Exabyte Files

Usage

Installation

  • Using Crates by adding neutrondb = "6.0.0" to Cargo.toml under [dependencies]

New

  • new: directory_path -> store/error
  • Example: let mut accounts_store: Store<Hash, Account> = Store::new("./ndb")?;

Put

  • put: &key, &value -> ()/error
  • Example: accounts_store.put(&Hash, &Account)?;

Get

  • get: &key -> value/error
  • Example: let account = accounts_store.get(&Hash)?;

Delete

  • delete: &key -> ()/error
  • Example: accounts_store.delete(&Hash)?;

Cache Limit

  • cache_limit: u64
  • sets cache limit
  • default & minimum cache limit is 1MB
  • Example: accounts_store.cache_limit(1_000_000_000)

Future

  • πŸš€ batching requests for performance
  • πŸ“₯ store.puts(&[(K,V)])
  • πŸ“€ store.gets(&[K]) -> BTreeMap<K,V>
  • πŸ—ΊοΈ store.map: (Fn: (K,V) -> T) -> Vec
  • 🧠 store.fold: acc, Fn: (K,V) -> acc -> acc
  • πŸ” store.any: Fn: (K,V) -> bool -> V
  • πŸ—„ store.all: Fn: (K,V) -> bool -> BTreeMap<K,V>
  • πŸ“Έ snapshots

Scaling

  • Supports 64bit Data Positions
  • Use ZFS

Memory

NeuronDB requires memory:

  • General: Graves(Key Hashes of deleted items)
  • Cache: Key Hashes & Values
  • Flushing & Compaction: New Table Index & Data Locaions

License

MIT License

Copyright Stelar Labs

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Commit count: 54

cargo fmt