Skip to content

Commit

Permalink
slot db doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmlm committed Jul 20, 2023
1 parent 7028182 commit af80faf
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
6 changes: 3 additions & 3 deletions utils/slot_db/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "vsdb_slot_db"
version = "0.7.4"
version = "0.7.5"
edition = "2021"
keywords = ["database", "timestamp", "slot", "web"]
keywords = ["index", "cache", "timestamp", "slot", "database"]
license = "MIT"
authors = ["hui.fan@mail.ru"]
description = "A skip-list like timestamp DB"
description = "A skip-list like index cache"
homepage = "https://github.com/rust-util-collections/vsdb"
repository = "https://github.com/rust-util-collections/vsdb"

Expand Down
8 changes: 7 additions & 1 deletion utils/slot_db/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@

# Slot DB

A `Skip List`-like timestamp database, based on the powerful [`vsdb`](https://crates.io/crates/vsdb) crate.
A `Skip List`-like index cache, based on the powerful [`vsdb`](https://crates.io/crates/vsdb) crate.

If you have a big key-value database, and you need high-performance pagination display or data analysis based on that data, then this crate may be a great tool for you.

## Usage

For examples, please check [**the embed test cases**](src/test.rs).
12 changes: 11 additions & 1 deletion utils/slot_db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ type Distance = i128;
type PageSize = u16;
type PageIndex = u32;

/// A `Skip List` like structure
/// A `Skip List` like structure,
/// designed to support fast paged queries and indexes
#[derive(Debug, Deserialize, Serialize)]
#[serde(
bound = "T: Clone + Ord + KeyEnDeOrdered + Serialize + de::DeserializeOwned"
Expand Down Expand Up @@ -59,6 +60,15 @@ impl<T> SlotDB<T>
where
T: Clone + Ord + KeyEnDeOrdered + Serialize + de::DeserializeOwned,
{
///
/// @param: `swap_order`:
///
/// Switch the inner logic of the slot direction:
/// - positive => reverse
/// - reverse => positive
///
/// Positive query usually get better performance,
/// swap order if most cases run in the reverse mode
pub fn new(multiple_step: u64, swap_order: bool) -> Self {
Self {
data: MapxOrd::new(),
Expand Down

0 comments on commit af80faf

Please sign in to comment.