Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/al8n/skipdb
An embedded, in-memory, zero-copy, atomicity, consistency, isolation, MVCC, almost lock-free and serializable snapshot isolation database engine.
https://github.com/al8n/skipdb
acid inmemory inmemory-db key-value key-value-database key-value-store kv kvstore lock-free mvcc rust serializable-snapshot-isolation ssi
Last synced: 10 days ago
JSON representation
An embedded, in-memory, zero-copy, atomicity, consistency, isolation, MVCC, almost lock-free and serializable snapshot isolation database engine.
- Host: GitHub
- URL: https://github.com/al8n/skipdb
- Owner: al8n
- License: apache-2.0
- Created: 2024-03-10T14:03:19.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-24T06:40:37.000Z (19 days ago)
- Last Synced: 2024-10-25T01:49:20.576Z (18 days ago)
- Topics: acid, inmemory, inmemory-db, key-value, key-value-database, key-value-store, kv, kvstore, lock-free, mvcc, rust, serializable-snapshot-isolation, ssi
- Language: Rust
- Homepage:
- Size: 361 KB
- Stars: 204
- Watchers: 3
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README-zh_CN.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE-APACHE
Awesome Lists containing this project
README
SkipDB & Watermark & Txn
This repository the implementation:
1. Generic optimistic transaction manger, which supports concurrent execution of transactions, providing serializable snapshot isolation, avoiding write skews.
2. An atomicity, consistency, isolation, MVCC and WASM friendly in-memory database based on the transaction manager.[][Github-url]
[][CI-url]
[][codecov-url][][doc-url]
[][crates-url]
[][crates-url][][async-doc-url]
[][async-crates-url]
[][async-crates-url][][txn-doc-url]
[][txn-crates-url]
[][txn-crates-url][][async-txn-doc-url]
[][async-txn-crates-url]
[][async-txn-crates-url][][wmark-doc-url]
[][wmark-crates-url]
[][wmark-crates-url]English | [简体中文][zh-cn-url]
## Introduction
This repository contains a transaction framework (`async-txn` and `txn`) based on optimistic concurrency control, which is inspired by [`foundationdb`'s paper](https://www.foundationdb.org/files/fdb-paper.pdf) and [`badger`](https://github.com/dgraph-io/badger).
This repository contains two kinds of in-memory key-value database which supports both async (`async-skipdb`) and sync (`skipdb`):
1. `SerializableDb`
Supports both concurrent execution of full serializable snapshot isolation transactions and optimistic concurrency control transactions.
Transactions are created by `SerializableDb::serializable_write` can handle all kinds of write skew correctly.
Transactions are created by `SerializableDb::optimistic_write` can handle all kinds of direct dependent write skew, but cannot handle all kinds of indirect dependent write skew e.g. https://wiki.postgresql.org/wiki/SSI#Intersecting_Data.
2. `OptimisticDb`
Only support oncurrent execution of optimistic concurrency control, which means the write transaction cannot detect all kinds of write skew.
All kinds of direct dependent write skew can be handled correctly, but cannot handle all kinds of indirect dependent write skew e.g. https://wiki.postgresql.org/wiki/SSI#Intersecting_Data.
### Features
- Atomicity, Consistency, Isolation, MVCC, 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.
- Async version is runtime agnostic, `tokio`, `async-std`, `smol`, `wasm-bindgen-futures` and any other async runtime.
- 100% safe, sets `[forbid(unsafe_code)]`.## Installation
- For sync
```toml
[dependencies]
skipdb = "0.2"
```- For async
- `tokio````toml
[dependencies]
async-skipdb = { version = "0.2", features = ["tokio"] }
```- `async-std`
```toml
[dependencies]
async-skipdb = { version = "0.2", features = ["async-std"] }
```- `smol`
```toml
[dependencies]
async-skipdb = { version = "0.2", features = ["smol"] }
```- `wasm-bindgen-futures`
```toml
[dependencies]
async-skipdb = { version = "0.2", features = ["wasm"] }
```## Examples
Please see [skipdb](./skipdb/) or [async-skipdb](./async-skipdb).
#### License
`skipdb` is under the terms of both the MIT license and the
Apache License (Version 2.0).See [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT) for details.
Copyright (c) 2024 Al Liu.
[Github-url]: https://github.com/al8n/skipdb/
[CI-url]: https://github.com/al8n/skipdb/actions/workflows/ci.yml[doc-url]: https://docs.rs/skipdb
[crates-url]: https://crates.io/crates/skipdb[async-doc-url]: https://docs.rs/async-skipdb
[async-crates-url]: https://crates.io/crates/async-skipdb[wmark-doc-url]: https://docs.rs/wmark
[wmark-crates-url]: https://crates.io/crates/wmark[async-txn-doc-url]: https://docs.rs/async-txn
[async-txn-crates-url]: https://crates.io/async-txn[txn-doc-url]: https://docs.rs/txn
[txn-crates-url]: https://crates.io/txn[codecov-url]: https://app.codecov.io/gh/al8n/skipdb/
[zh-cn-url]: https://github.com/al8n/skipdb/tree/main/README-zh_CN.md