dustdata

Crates.iodustdata
lib.rsdustdata
version2.0.0-beta.3
sourcesrc
created_at2022-06-18 01:01:33.737643
updated_at2024-03-24 17:21:17.031109
descriptionA data concurrency control storage engine to Rustbase
homepagehttps://github.com/rustbase/dustdata
repositoryhttps://github.com/rustbase/dustdata
max_upload_size
id608280
size47,921
Pedro Augusto (peeeuzin)

documentation

README

crates.io docs.rs

DustData

A data concurrency control storage engine to Rustbase

Join our community and chat with other Rust users.

⚠️ Warning

This is a work in progress. The API is not stable yet.

🔗 Contribute

Click here to see how to Contribute

How to install

Add the following to your Cargo.toml:

[dependencies]
dustdata = "2.0.0-beta.2"

Usage

Initialize a new DustData instance with the default configuration:

use dustdata::DustData;

let mut dustdata = DustData::new(Default::default()).unwrap();

Inserting data into a collection

#[derive(Serialize, Deserialize, Clone, Debug)]
struct User {
    name: String,
    age: u32,
}

let collection = dustdata.collection::<User>("users");

let user = User {
    name: "Pedro".to_string(),
    age: 21,
};

// Creating a new transaction.
let mut transaction = collection.start();

// Inserting the user into the transaction.
transaction.insert("user:1", user);

// Committing the transaction.
collection.commit(&mut transaction).unwrap();

// Done!

Reading data from a collection

let collection = dustdata.collection::<User>("users").unwrap();

let user = collection.get("user:1").unwrap();

Authors


@peeeuzin

License

MIT License

Commit count: 163

cargo fmt