Code Monkey home page Code Monkey logo

typed-sled's Introduction

typed-sled - a database build on top of sled

API

sled is a high-performance embedded database with an API that is similar to a BTreeMap<[u8], [u8]>.
typed-sled builds on top of sled and offers an API that is similar to a BTreeMap<K, V>, where K and V are user defined types.

Example

use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
struct SomeValue(u32);

// Creating a temporary sled database
let db = sled::Config::new().temporary(true).open().unwrap();

// The id is used by sled to identify which Tree in the database (db) to open
let tree = typed_sled::Tree::<String, SomeValue>::open(&db, "unique_id");

// insert and get, similar to std's BTreeMap
tree.insert(&"some_key".to_owned(), &SomeValue(10))?;

assert_eq!(tree.get(&"some_key".to_owned())?, Some(SomeValue(10)));
Ok(())

features

Multiple features for common use cases are available:

  • Search engine for searching through a tree's keys and values by using tantivy.
  • Automatic key generation.
  • Custom (de)serialization. By default bincode is used for (de)serialization, however custom (de)serializers are supported, making zero-copy or lazy (de)serialization possible.
  • Converting one typed Tree to another typed Tree with different key and value types.

typed-sled's People

Contributors

chronicl avatar dvdsk avatar bsaintjo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.