20 releases

Uses new Rust 2021

new 0.1.0-beta.7 Jun 29, 2022
0.1.0-beta.5 Jun 28, 2022
0.1.0-alpha.18 May 27, 2022
0.1.0-alpha.11 Apr 21, 2022
0.1.0-alpha.4 Mar 21, 2022

#19 in Database implementations

Download history 63/week @ 2022-03-16 25/week @ 2022-03-23 33/week @ 2022-03-30 90/week @ 2022-04-06 2/week @ 2022-04-13 82/week @ 2022-04-20 43/week @ 2022-04-27 96/week @ 2022-05-04 168/week @ 2022-05-11 64/week @ 2022-05-18 81/week @ 2022-05-25 110/week @ 2022-06-01 46/week @ 2022-06-08 20/week @ 2022-06-15 108/week @ 2022-06-22

287 downloads per month
Used in doublets-decorators

LGPL-3.0

150KB
4K SLoC

Doublets

A library that represents database engine that uses doublets.

Overview

Example

A basic CRUD in doublets

use doublets::data::Flow::Continue;
use doublets::mem::FileMappedMem;
use doublets::{united, Doublets};
use std::fs::File;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // create or open read/write file
    let file = File::options()
        .create(true)
        .read(true)
        .write(true)
        .open("db.links")?;

    let mem = FileMappedMem::new(file)?;
    let mut links = united::Store::<usize, _>::new(mem)?;

    // Creation of the doublet in tiny style
    let mut point = links.create()?;

    // Update of the doublet in handler style
    // The link is updated to reference itself twice (as source and target):
    links.update_with(point, point, point, |_, after| {
        // link is { index, source, target }
        point = after.index;
        // give handler state (any ops::Try)
        Continue
    })?;

    println!("The number of links in the data store is {}", links.count());
    println!("Data store contents:");

    links.try_each(|link| {
        println!("{}", link);
        Continue
    });

    // The link deletion in full style:
    let any = links.constants().any;
    // query in [index source target] style
    links.delete_by_with([point, any, any], |before, _| {
        println!("Goodbye {}", before);
        Continue
    })?;
    Ok(())
}

Dependencies

~1–1.5MB
~30K SLoC