Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024 02 22 #19

Merged
merged 7 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 35 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ members = [
# Internal
"examples",
]

[workspace.lints.rust]
unused_parens = "allow"

[workspace.lints.clippy]
needless_return = "allow"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/rust:1.75-slim-bookworm AS builder
FROM docker.io/rust:1.76-slim-bookworm AS builder
RUN apt-get update && \
apt-get install -y pkg-config libssl-dev && \
rm -rf /var/lib/apt/lists/*
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ docker run -dit --rm -p 3030:3030 --name rapiddb kruserr/rapiddb:0.1
### Use the database with curl
Write to database with curl
```bash
curl -X POST localhost:3030/api/v0/test-0 -H 'Content-Type: application/json' -d '{"temp":4.00}'
curl -X POST localhost:3030/api/v0/test-0 -d '{"temp":4.00}'
```

Read from database with curl
Expand Down
2 changes: 1 addition & 1 deletion docs/dockerhub.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ docker run -dit --rm -p 3030:3030 --name rapiddb kruserr/rapiddb:0.1
### Use the database with curl
Write to database with curl
```bash
curl -X POST localhost:3030/api/v0/test-0 -H 'Content-Type: application/json' -d '{"temp":4.00}'
curl -X POST localhost:3030/api/v0/test-0 -d '{"temp":4.00}'
```

Read from database with curl
Expand Down
14 changes: 10 additions & 4 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ version = "0.0.0"
publish = false
edition = "2021"

[lints]
workspace = true

# [lib]
#doctest = false

[dependencies]
# rapiddb = { path = "../rapiddb" }
rapiddb = { path = "../rapiddb" }
rapiddb-web = { path = "../rapiddb-web" }

tokio = { version = "1", features = ["full"] }
Expand All @@ -21,6 +27,6 @@ path = "init.rs"
name = "bench-mmav"
path = "bench-mmav.rs"

# [[example]]
# name = "only-db"
# path = "only-db.rs"
[[example]]
name = "only-db"
path = "only-db.rs"
10 changes: 3 additions & 7 deletions examples/only-db.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
use rapiddb::traits::IDatabase;

pub fn main() {
let db = std::sync::Arc::new(
std::sync::RwLock::new(
rapiddb::db::MMAVDatabase::new()
)
);
let mut db = rapiddb::db::MMAVDatabase::new();

let value = b"{\"key\": \"value\"}";
db.write().unwrap().post("test-0", value);
assert_eq!(db.write().unwrap().get_latest("test-0"), value);
db.post("test-0", value);
assert_eq!(db.get_latest("test-0"), value);
}
9 changes: 6 additions & 3 deletions rapiddb-web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ description = "A reasonably fast configurable embedded key-value sensor database
keywords = ["database", "embedded-database", "db", "persistence", "key-value"]
categories = ["database", "database-implementations", "caching"]

[lints]
workspace = true

# [lib]
#doctest = false

[dependencies]
rapiddb = { version = "0.1", path = "../rapiddb" }

tokio = { version = "1", features = ["full"] }
warp = "0.3"
serde = "1.0"
serde_json = "1.0"

[lib]
#doctest = false
2 changes: 1 addition & 1 deletion rapiddb-web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
//! ### Use the database with curl
//! Write to database with curl
//! ```bash
//! curl -X POST localhost:3030/api/v0/test-0 -H 'Content-Type: application/json' -d '{"temp":4.00}'
//! curl -X POST localhost:3030/api/v0/test-0 -d '{"temp":4.00}'
//! ```
//!
//! Read from database with curl
Expand Down
9 changes: 6 additions & 3 deletions rapiddb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ description = "A reasonably fast configurable embedded key-value sensor database
keywords = ["database", "embedded-database", "db", "persistence", "key-value"]
categories = ["database", "database-implementations", "caching"]

[lints]
workspace = true

# [lib]
#doctest = false

[dependencies]
tokio = { version = "1", features = ["sync"] }
serde = "1.0"
Expand All @@ -19,6 +25,3 @@ async-trait = "0.1"

[dev-dependencies]
tokio-test = "0.4"

[lib]
#doctest = false
Loading