Skip to content

Commit

Permalink
Add keywords and categories
Browse files Browse the repository at this point in the history
  • Loading branch information
al8n committed Apr 25, 2024
1 parent 01f545c commit f97166c
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ English | [简体中文][zh-cn-url]
- Lock-free and concurrent safe read transaction: the read transaction is totally concurrent safe and can be shared in multiple threads, there is no lock in read transaction.
- `BTreeMap` like user friendly API and all iterators implement `Iterator` trait, which means users use Rust powerful conbinators when iterating over the database.
- Async version is runtime agnostic, `tokio`, `async-std`, `smol`, `wasm-bindgen-futures` and any other async runtime.
- 100% safe, skipdb sets `[forbid(unsafe_code)]`.
- 100% safe, sets `[forbid(unsafe_code)]`.

## Installation

Expand Down
6 changes: 4 additions & 2 deletions async-skipdb/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
[package]
name = "async-skipdb"
version.workspace = true
version = "0.1.3"
rust-version.workspace = true
edition.workspace = true
repository.workspace = true
homepage.workspace = true
documentation = "https://docs.rs/async-skipdb"
description = "A blazing fast ACID, MVCC and SSI in memory database based on lock-free skiplist."
description = "An embedded, in-memory, ACID, MVCC, almost lock-free and serializable snapshot isolation database engine."
license.workspace = true
keywords = ["database", "key-value-store", "memdb", "embedded-database", "memodb"]
categories = ["database-implementations", "concurrency", "data-structures", "asynchronous"]

[features]
default = []
Expand Down
2 changes: 1 addition & 1 deletion async-skipdb/README-zh_CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">
<h1>SkipDB</h1>
<h1>Async SkipDB</h1>
</div>
<div align="center">

Expand Down
4 changes: 2 additions & 2 deletions async-skipdb/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">
<h1>SkipDB</h1>
<h1>Async SkipDB</h1>
</div>
<div align="center">

Expand Down Expand Up @@ -40,7 +40,7 @@ For sync version, please see [`skipdb`](https://crates.io/crates/skipdb).
- Lock-free and concurrent safe read transaction: the read transaction is totally concurrent safe and can be shared in multiple threads, there is no lock in read transaction.
- `BTreeMap` like user friendly API and all iterators implement `Iterator` trait, which means users use Rust powerful conbinators when iterating over the database.
- Runtime agnostic, `tokio`, `async-std`, `smol`, `wasm-bindgen-futures` and any other async runtime.
- 100% safe, skipdb sets `[forbid(unsafe_code)]`.
- 100% safe, sets `[forbid(unsafe_code)]`.

## Installation

Expand Down
6 changes: 4 additions & 2 deletions skipdb/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
[package]
name = "skipdb"
version.workspace = true
version = "0.1.3"
rust-version.workspace = true
edition.workspace = true
repository.workspace = true
homepage.workspace = true
documentation = "https://docs.rs/skipdb"
description = "A blazing fast ACID, MVCC and SSI in memory database based on lock-free skiplist."
description = "An embedded, in-memory, ACID, MVCC, almost lock-free and serializable snapshot isolation database engine."
license.workspace = true
keywords = ["database", "key-value-store", "memdb", "embedded-database", "memodb"]
categories = ["database-implementations", "concurrency", "data-structures"]

[features]
default = []
Expand Down
117 changes: 113 additions & 4 deletions skipdb/README-zh_CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">
<h1>SkiplistDB</h1>
<h1>SkipDB</h1>
</div>
<div align="center">

Expand All @@ -18,7 +18,7 @@ Blazing fast ACID and MVCC in memory database based on lock-free skiplist.
[<img alt="crates.io" src="https://img.shields.io/crates/d/skipdb?color=critical&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB0PSIxNjQ1MTE3MzMyOTU5IiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0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C45MjgtMTQ0Ljk2LTE3MS43NzZsLTI5LjUwNC0yLjU2LTUuODg4LTMwLjk3NnoiIGZpbGw9IiNmZmZmZmYiIHAtaWQ9IjM0MjIiIGRhdGEtc3BtLWFuY2hvci1pZD0iYTMxM3guNzc4MTA2OS4wLmkwIiBjbGFzcz0iIj48L3BhdGg+PC9zdmc+&style=for-the-badge" height="22">][crates-url]


[English][en-us-url] | 简体中文
English | [简体中文][zh-cn-url]

</div>

Expand All @@ -28,13 +28,122 @@ Blazing fast ACID and MVCC in memory database based on lock-free skiplist.

`skipdb` uses the same SSI (Serializable Snapshot Isolation) transaction model used in [`badger`](https://github.com/dgraph-io/badger).

For async usage, please see [`async-skipdb`](https://crates.io/crates/async-skipdb).

## Features

- ACID, MVCC, serializable snapshot isolation, concurrent safe and almost lock-free.
- No extra allocation and copy, there is no `Arc` wrapper for both key and value stored in the database, which means that users provide `K` and `V`, and database store `K` and `V` directly.
- Zero-copy and in-place compaction, which means there is no copy, no extra allocation when compacting.
- Concurrent execution of transactions, providing serializable snapshot isolation, avoiding write skews.
- Both read transaction and write transaction are `Send + Sync + 'static`, which means you do not need to handle annoying lifetime problem anymore.
- Lock-free and concurrent safe read transaction: the read transaction is totally concurrent safe and can be shared in multiple threads, there is no lock in read transaction.
- `BTreeMap` like user friendly API and all iterators implement `Iterator` trait, which means users use Rust powerful conbinators when iterating over the database.
- 100% safe, sets `[forbid(unsafe_code)]`.

## Installation

```toml
[dependencies]
skipdb = "0.0.0"
skipdb = "0.1"
```

## Example

- If your `K` implement `Hash`.

```rust
use skipdb::equivalent::EquivalentDb;

#[derive(Debug)]
struct Person {
hobby: String,
age: u8,
}

fn main() {
let db: EquivalentDb<String, Person> = EquivalentDb::new();

{
let alice = Person { hobby: "swim".to_string(), age: 20 };
let bob = Person { hobby: "run".to_string(), age: 30 };

let mut txn = db.write();
txn.insert("Alice".to_string(), alice).unwrap();
txn.insert("Bob".to_string(), bob).unwrap();

{
let alice = txn.get("Alice").unwrap().unwrap();
assert_eq!(alice.value().age, 20);
assert_eq!(alice.value().hobby, "swim");
}

txn.commit().unwrap();
}

{
let txn = db.read();
let alice = txn.get("Alice").unwrap();
assert_eq!(alice.value().age, 20);
assert_eq!(alice.value().hobby, "swim");

let bob = txn.get("Bob").unwrap();
assert_eq!(bob.value().age, 30);
assert_eq!(bob.value().hobby, "run");
}
}
```

- If your key cannot implement `Hash` for some reasons.

Then you can use `ComparableDb`, but this will require `K: CheapClone + Ord`, you can see [`cheap_clone`](https://crates.io/crates/cheap-clone) trait for more details.

```rust
use skipdb::comparable::ComparableDb;

#[derive(Debug)]
struct Person {
name: String,
hobby: String,
age: u8,
}

fn main() {
let db: ComparableDb<u64, Person> = ComparableDb::new();

{
let alice = Person { name: "Alice".to_string(), hobby: "swim".to_string(), age: 20 };
let bob = Person { name: "Bob".to_string(), hobby: "run".to_string(), age: 30 };

let mut txn = db.write();
txn.insert(1, alice).unwrap();
txn.insert(2, bob).unwrap();

{
let alice = txn.get(&1).unwrap().unwrap();
assert_eq!(alice.value().name, "Alice");
assert_eq!(alice.value().age, 20);
assert_eq!(alice.value().hobby, "swim");
}

txn.commit().unwrap();
}

{
let txn = db.read();
let alice = txn.get(&1).unwrap();
assert_eq!(alice.value().name, "Alice");
assert_eq!(alice.value().age, 20);
assert_eq!(alice.value().hobby, "swim");

let bob = txn.get(&2).unwrap();
assert_eq!(bob.value().name, "Bob");
assert_eq!(bob.value().age, 30);
assert_eq!(bob.value().hobby, "run");
}
}
```

#### License

`skipdb` is under the terms of both the MIT license and the
Expand All @@ -49,4 +158,4 @@ Copyright (c) 2024 Al Liu.
[doc-url]: https://docs.rs/skipdb
[crates-url]: https://crates.io/crates/skipdb
[codecov-url]: https://app.codecov.io/gh/al8n/skipdb/
[en-us-url]: https://github.com/al8n/skipdb/tree/main/README.md
[zh-cn-url]: https://github.com/al8n/skipdb/tree/main/README-zh_CN.md
2 changes: 1 addition & 1 deletion skipdb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ For async usage, please see [`async-skipdb`](https://crates.io/crates/async-skip
- Both read transaction and write transaction are `Send + Sync + 'static`, which means you do not need to handle annoying lifetime problem anymore.
- Lock-free and concurrent safe read transaction: the read transaction is totally concurrent safe and can be shared in multiple threads, there is no lock in read transaction.
- `BTreeMap` like user friendly API and all iterators implement `Iterator` trait, which means users use Rust powerful conbinators when iterating over the database.
- 100% safe, skipdb sets `[forbid(unsafe_code)]`.
- 100% safe, sets `[forbid(unsafe_code)]`.

## Installation

Expand Down

0 comments on commit f97166c

Please sign in to comment.