Code Monkey home page Code Monkey logo

typedb's Introduction

typedb

crates.io version Build status Documentation

Simple persistent generic HashMap/Key-value store, using file locking to limit writing between threads.

This is in a beta state at the moment.

Documentation

Basic usage:

use typedb::{ KV, Value };

fn main() {
    let mut test_store = KV::<String, Value>::new("./db.cab");

    let _ = test_store.insert("key".to_string(), Value::String("value".to_string()));
    println!("{:?}", test_store.get("key".to_string()));
    let _ = test_store.remove("key".to_string());
}

Usage with user defined Key and Value types:

use typedb::{KV, key, value};
use serde_derive::{ Serialize, Deserialize };

key!(
enum MyKey {
    String(String),
    Int(i32),
});

value!(
enum MyValue {
    String(String),
    Int(i32),
});

fn main() {
    let mut test_store = KV::<MyKey, MyValue>::new("./db.cab").unwrap();

    let _ = test_store.insert(MyKey::Int(1i32), MyValue::String("value".to_string()));
    println!("{:?}", test_store.get(MyKey::Int(1i32)));
    let _ = test_store.remove(MyKey::Int(1i32));
}

License

typedb's People

Contributors

shockham avatar semoar avatar

Stargazers

njubi avatar Sergei Sen avatar Markus avatar Vitaliy Yermolenko avatar Shahked Bleicher avatar Robert Gabriel Jakabosky avatar Sal Sal avatar Greedwolf DSS avatar  avatar clint21.eth ⚡️ avatar  avatar  avatar Jeff Muizelaar avatar

Watchers

 avatar James Cloos avatar

Forkers

semoar

typedb's Issues

Utilize persy index feature

This crate could probably utilize the persy index feature, which could reduce backend boilerplate code, althrough it would make the file format incompatible.

Partial solution for file format incompatibility:

  • On (first?) LOAD, check if file format is old or new, deserialize accordingly.
  • On SAVE, we need to know a preference (e.g. old or new), assume new, but provide a function to serialize to the old file format.

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.