Skip to content

Commit 59e7665

Browse files
committed
Add sled support
Global and TREE iteration
1 parent 8724503 commit 59e7665

22 files changed

+704
-172
lines changed

Cargo.lock

+84-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+23-5
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ border-radius: 10px;" src="https://user-images.githubusercontent.com/56880684/20
3939

4040
## Features
4141

42-
- Multi embedded database supported: `RocksDB`, `Redb`
42+
- Multi embedded database supported: `RocksDB`, `Redb`, `Sled
43+
- `
4344
- Cross-platform supported: `Windows`, `Linux` and `MacOS`
4445
- Custom byte layout deserialization
4546
- Execute database command directly in terminal
@@ -48,10 +49,22 @@ border-radius: 10px;" src="https://user-images.githubusercontent.com/56880684/20
4849

4950
## Roadmap
5051

51-
- [ ] NEW: Universal Key Value Storage support (UKV)
52-
- [ ] NEW: Sled support
53-
- [ ] NEW: LevelDB support
54-
- [ ] Adding consistent mode for editor view
52+
- [ ] NEW: Universal Key Value Storage support (UKV)
53+
- [x] NEW: Sled support
54+
- [ ] NEW: LevelDB support
55+
- [ ] Adding consistent mode for editor view
56+
57+
## Supported Storages
58+
59+
EDMA supports multiple databases with easy plug-to-play architecture. Please check below list for supported databases and its features:
60+
61+
| Database name | Description | EDMA release | Pull request |
62+
| ------------- | -------------------------------------------------------------- | --------------------------------------------------------------------------- | ----------------------------------------------------------- |
63+
| RocksDB | Support both non-column and column byte data viewer (`COLUMN`) | [v0.1.0-beta.4](https://github.com/nomadiz/edma/releases/tag/v0.1.0-beta.4) | N/A |
64+
| ReDB | Support default database (Will add `TABLE` view) | [v0.1.0-beta.4](https://github.com/nomadiz/edma/releases/tag/v0.1.0-beta.4) | N/A |
65+
| Sled | Support both non-tree and tree byte data viewer (`TREE`) | [v0.1.0-beta.5](https://github.com/nomadiz/edma/releases/tag/v0.1.0-beta.5) | [#8 Sled support](https://github.com/nomadiz/edma/issues/8) |
66+
67+
To create a PR for a database integration, please go to [`Issues > New Issue > Feature request`](https://github.com/nomadiz/edma/issues/new?assignees=&labels=&template=feature_request.md&title=)
5568

5669
## Getting Started
5770

@@ -202,6 +215,7 @@ Database name should be these two below
202215

203216
- `rocksdb`: RocksDB
204217
- `redb`: Redb
218+
- `sled`: Sled
205219

206220
Database path should be `String` type
207221

@@ -246,6 +260,10 @@ Configuration file example
246260
{
247261
"name": "rocksdb",
248262
"path": "/temp"
263+
},
264+
{
265+
"name": "sled",
266+
"path": "/temp/sled"
249267
}
250268
],
251269
"templates": [

db/CARGO.md

+10-62
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,15 @@
1-
<p align="center">
2-
<img src="https://user-images.githubusercontent.com/56880684/201497081-40976107-ef47-4a12-bf6d-ceafc8da3464.png" width="40%"/>
3-
</p>
4-
<h3 align="center">A distributed Gremlin-compatible graph database</h3>
1+
## Embedded database library for EDMA
52

6-
<h3 align="center">Open for contribution 🚀</h3>
7-
<br/>
3+
**NOTE:** (SolomonDB Forked)
84

9-
<p align="center">
10-
<a href="https://github.com/nomadiz/solomon-db"><img src="https://img.shields.io/badge/built_with-Rust-dca282.svg?style=flat-square"></a>
11-
&nbsp;
12-
<a href="https://github.com/nomadiz/solomon-db"><img src="https://img.shields.io/badge/build%20with-gremlin-green"></a>
13-
&nbsp;
14-
<a href="https://github.com/nomadiz/solomon-db"><img src="https://img.shields.io/github/v/release/nomadiz/solomon-db?color=%23ff00a0&include_prereleases&label=version&sort=semver&style=flat-square"></a>
15-
&nbsp;
16-
<a href="https://github.com/nomadiz/solomon-db/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT License-00bfff.svg?style=flat-square"></a>
5+
### Description
176

18-
</p>
19-
<p align="center">
20-
<a href="https://github.com/nomadiz/solomon-db/graphs/contributors" alt="Contributors">
21-
<img src="https://img.shields.io/github/contributors/nomadiz/solomon-db" /></a>
22-
<a href="https://github.com/nomadiz/solomon-db/pulse" alt="Activity">
23-
&nbsp;
24-
<img src="https://img.shields.io/github/commit-activity/m/nomadiz/solomon-db" /></a>
25-
<a href="https://users.rust-lang.org/t/solomondb-in-development-gremlin-compatible-graph-database-update/84750" alt="Activity">
26-
&nbsp;
27-
<img src="https://img.shields.io/badge/Rust%20User%20Forum-follow-orange"/>
28-
</a>
29-
</p>
7+
Embedded database library that can be installed as Rust crate. This can be used to run an embedded graph database on top of other multiple storage engines
308

31-
## What is SolomonDB?
9+
### Storage layer
3210

33-
**SolomonDB** is an open source, distributed, easy-to-use, user friendly graph database built by nomadic engineers. SolomonDB enhances the experience of working with graph database using GQL (Gremlin Query Language). SolomonDB can run in an offline mode and acts as an embedded graph database on top of **RocksDB**. Last but not least, SolomonDB is a database for community. It supports multiple storage layer with a set of plugins for serialization.
34-
35-
## Why is it named "Solomon"?
36-
37-
Solomon is the name of a the wisest person who ever lived, King Solomon. If you have ever read Bible, you might know some stories of King Solomon. One of those stories is when King Solomon asks for wishdom. Based on that idea, Solomon DB is built as my personal side project to gain more knowledge about database internals and graph database architecture.
38-
39-
## Roadmap
40-
41-
- [x] Implement RocskDB storage layer
42-
- [x] Implement Redb storage layer
43-
- [ ] Database server
44-
- [ ] Embedded library
45-
- [ ] Support Gremlin query language
46-
- [ ] Multi-row, multi-table ACID transactions
47-
- [ ] Single-node, or highly-scalable distributed mode
48-
- [ ] Store structured and unstructured data
49-
- [ ] Client (JS / Rust / Go) library
50-
51-
## Documentation
52-
53-
For guidance on installation, development, deployment, and administration, see our [SolomonDB documentation](https://nomadiz.github.io/solomon-db/).
54-
55-
The documentation page is built using Rust Mdbook. Shoutout to Rust ecosystem. ❤️
56-
57-
## Community
58-
59-
Join our growing community around the world, for help, ideas, and discussions regarding SurrealDB.
60-
61-
- View SolomonDB [Blog](https://nomadiz.hashnode.dev/)
62-
- View weekly announcement [Rust language Forum](https://users.rust-lang.org/t/solomondb-gremlin-compatible-graph-database-weekly-update/84750)
63-
64-
Support the creator
65-
66-
- [Github](https://github.com/chungquantin)
67-
- [Twitter](https://twitter.com/chasechung111)
11+
| Name | Type | Concurrency | Description |
12+
| ----------- | --------- | --------------- | ------------------------------------------------------------------------------------------------------------------ |
13+
| **RocksDB** | key-value | Multi-threaded | OptimisticTransactionDB of RocksDB is applied into SolomonDB to allow ACID transaction with multithreaded feature. |
14+
| **Redb** | key-value | Single-threaded | Simple use case of Redb is efficient for simple on-disk store. |
15+
| **Sled** | key-value | Single-threaded | The champagne of beta embedded databases |

db/Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "edma_storage"
3-
version = "0.0.1"
3+
version = "0.0.2"
44
publish = true
55
edition = "2021"
66
readme = "CARGO.md"
@@ -21,14 +21,16 @@ license = "MIT"
2121

2222

2323
[features]
24-
default = ["kv-redb", "kv-rocksdb", "test-suite"]
24+
default = ["kv-redb", "kv-rocksdb", "kv-sled", "test-suite"]
25+
kv-sled = ["dep:sled"]
2526
kv-rocksdb = ["dep:rocksdb"]
2627
kv-redb = ["dep:redb"]
2728
test-suite = []
2829
debug-suite = []
2930

3031
[dependencies]
3132
redb = { version = "0.10.0", optional = true }
33+
sled = { version = "0.34.7", optional = true }
3234
rocksdb = { version = "0.19.0", optional = true, features = [
3335
"multi-threaded-cf",
3436
] }

db/src/constant/cf.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub enum ColumnFamily {
88
}
99

1010
lazy_static! {
11-
pub static ref COLUMN_FAMILIES: HashMap<ColumnFamily, String> =
11+
pub static ref KEYSPACES: HashMap<ColumnFamily, String> =
1212
HashMap::from([(ColumnFamily::TestSuite, "test_suite:v1".to_string()),]);
13-
pub static ref CF_NAMES: Vec<&'static String> = COLUMN_FAMILIES.values().collect();
13+
pub static ref CF_NAMES: Vec<&'static String> = KEYSPACES.values().collect();
1414
}

db/src/err/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,10 @@ impl From<redb::Error> for Error {
6767
Error::Tx(e.to_string())
6868
}
6969
}
70+
71+
#[cfg(feature = "kv-sled")]
72+
impl From<sled::Error> for Error {
73+
fn from(e: sled::Error) -> Error {
74+
Error::Tx(e.to_string())
75+
}
76+
}

db/src/model/tag.rs

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ impl TagBucket {
2828
self.0.get(key).cloned()
2929
}
3030

31+
pub fn insert(&mut self, key: TagKey, val: TagValue) {
32+
self.0.insert(key, val);
33+
}
34+
3135
pub fn unchecked_get(&self, key: TagKey) -> TagValue {
3236
self.0.get(key).unwrap().clone()
3337
}

0 commit comments

Comments
 (0)