vsdb_slot_db

Crates.iovsdb_slot_db
lib.rsvsdb_slot_db
version5.0.0
created_at2023-06-12 11:22:04.592528+00
updated_at2025-08-11 04:13:44.131398+00
descriptionA skip-list like index cache
homepagehttps://github.com/rust-util-collections/vsdb
repositoryhttps://github.com/rust-util-collections/vsdb
max_upload_size
id888100
size73,856
中正 (haxjump)

documentation

README

vsdb_slot_db

Crates.io Docs.rs License Rust

A skip-list like index cache.

A Skip List-like index cache, based on the powerful vsdb crate.

If you have a large key-value database and need high-performance pagination or data analysis, this crate could be a great tool for you.

Installation

Add this to your Cargo.toml:

[dependencies]
vsdb_slot_db = "4.0"

Usage

SlotDB is a skip-list-like index cache that can be used for high-performance pagination and data analysis.

use vsdb_slot_db::{SlotDB, Slot};

// Create a new SlotDB with a maximum of 16 entries per slot
let mut db: SlotDB<String> = SlotDB::new(16, false);

// Insert some data with slot numbers
db.insert(1, "data1".to_string()).unwrap();
db.insert(1, "data2".to_string()).unwrap();
db.insert(2, "data3".to_string()).unwrap();

// Get entries by page
let page1 = db.get_entries_by_page(10, 0, false);
assert_eq!(page1.len(), 3);

// Get entries by page with a specific slot range
let page2 = db.get_entries_by_page_slot(Some(1), Some(1), 10, 0, false);
assert_eq!(page2.len(), 2);
assert_eq!(page2[0], "data1");
assert_eq!(page2[1], "data2");

License

This project is licensed under the MIT license.

Commit count: 382

cargo fmt