Crates.io | ledger-kv |
lib.rs | ledger-kv |
version | 0.1.0 |
source | src |
created_at | 2023-11-01 13:23:33.360448 |
updated_at | 2023-11-01 13:23:33.360448 |
description | A Rust-based key-value store designed for append-only data storage. Features SHA-256 checksums for data integrity and cross-compiles to wasm32 for smart contract applications. |
homepage | |
repository | |
max_upload_size | |
id | 1021006 |
size | 57,301 |
LedgerKV is a key-value store implemented in Rust. The primary feature of this library is its ability to store data in an append-only fashion, effectively forming a ledger. Additionally, it supports data integrity checks using SHA-256 checksums for ledger entries.
This library is designed for use in smart contract environments, capable of compiling for wasm32
targets while also being usable and testable on x86_64
architectures.
Note: This library is still in the development stage. Use it at your own risk.
Add LedgerKV to your Cargo.toml
:
[dependencies]
ledger-kv = "0.1.0"+
Here is a basic example to get you started:
use ledger_kv::LedgerKV; // Replace with your actual library name
use ledger_kv::EntryLabel;
use ledger_kv::Operation;
let data_dir = PathBuf::from("data/");
let description = "example_ledger";
// Create a new LedgerKV instance
let mut ledger = LedgerKV::new(data_dir, description);
// Perform an upsert operation
let key = vec![1, 2, 3];
let value = vec![4, 5, 6];
ledger.upsert(EntryLabel::NodeProvider, key, value).unwrap();
// Perform a delete operation
let key = vec![1, 2, 3];
ledger.delete(EntryLabel::NodeProvider, key).unwrap();
This library is implemented in pure Rust.
We welcome contributions! Please submit a pull request if you would like to contribute.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.