Skip to content

Commit 044270d

Browse files
authored
feat: database crate (#225)
1 parent b4d04bf commit 044270d

44 files changed

Lines changed: 1752 additions & 258 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ jobs:
6464
steps:
6565
- uses: actions/checkout@v4
6666
with:
67-
ref: 'main'
67+
ref: "main"
6868
- id: get-current-version
6969
run: echo MAIN_VERSION=$(cat VERSION) >> $GITHUB_ENV
7070
- uses: actions/checkout@v4
7171
with:
72-
ref: ${{ github.head_ref || github.ref_name }}
72+
ref: ${{ github.head_ref || github.ref_name }}
7373
token: ${{ secrets.RELEASE_PAT }}
7474
- id: bump-version
7575
run: |
@@ -78,14 +78,14 @@ jobs:
7878
7979
TODAY=$(date +"%y%m%d")
8080
81-
if [[ $MAIN_MAJOR == $TODAY ]]; then
81+
if [[ $MAIN_MAJOR == $TODAY ]]; then
8282
NEW_VERSION=$MAIN_MAJOR.$((MAIN_MINOR + 1))
8383
else
8484
NEW_VERSION=$TODAY.0
8585
fi
8686
8787
LOCAL_VERSION=$(cat VERSION)
88-
if [[ $LOCAL_VERSION == $NEW_VERSION ]]; then
88+
if [[ $LOCAL_VERSION == $NEW_VERSION ]]; then
8989
exit 0
9090
fi
9191
@@ -119,6 +119,7 @@ jobs:
119119
cargo-test:
120120
needs: [changed-files]
121121
if: needs.changed-files.outputs.rust == 'true'
122+
timeout-minutes: 20
122123
runs-on:
123124
group: ubuntu-runners
124125
strategy:
@@ -146,7 +147,7 @@ jobs:
146147
else
147148
echo Unexpected test kind $TEST_KIND
148149
exit 1
149-
fi
150+
fi
150151
151152
cargo-fmt:
152153
needs: [changed-files]
@@ -188,7 +189,15 @@ jobs:
188189
command: check license
189190

190191
docker-build-push:
191-
needs: [changed-files, cargo-build, cargo-test, cargo-fmt, cargo-clippy, cargo-deny]
192+
needs:
193+
[
194+
changed-files,
195+
cargo-build,
196+
cargo-test,
197+
cargo-fmt,
198+
cargo-clippy,
199+
cargo-deny,
200+
]
192201
if: |
193202
needs.changed-files.result != 'failure' &&
194203
(needs.changed-files.outputs.rust == 'true' || needs.changed-files.outputs.dockerfile == 'true') &&
@@ -204,7 +213,7 @@ jobs:
204213
fail-fast: false
205214
steps:
206215
- uses: actions/checkout@v4
207-
216+
208217
- uses: docker/login-action@v2
209218
with:
210219
registry: ghcr.io
@@ -250,7 +259,7 @@ jobs:
250259

251260
release:
252261
needs: [changed-files]
253-
if: github.ref_name == 'main' && needs.changed-files.outputs.version == 'true'
262+
if: github.ref_name == 'main' && needs.changed-files.outputs.version == 'true'
254263
runs-on: ubuntu-latest
255264
steps:
256265
- uses: actions/checkout@v4
@@ -269,7 +278,7 @@ jobs:
269278
270279
- name: push-tag
271280
run: |
272-
VERSION=$(cat VERSION)
281+
VERSION=$(cat VERSION)
273282
274283
git tag $VERSION
275284
git push origin "$VERSION"

Cargo.lock

Lines changed: 90 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pulse_api = { package = "wcn_pulse_api", path = "crates/pulse_api" }
4646
pulse_monitor = { path = "crates/pulse_monitor" }
4747
raft = { path = "crates/raft" }
4848
wcn_rpc = { path = "crates/rpc" }
49-
relay_rocks = { path = "crates/rocks" }
49+
wcn_rocks = { path = "crates/rocks" }
5050
metrics = "0.23"
5151
time = "0.3"
5252
libp2p = { version = "0.55", default-features = false, features = ["serde"] }
@@ -99,3 +99,5 @@ unnecessary_box_returns = "warn"
9999
unnecessary_self_imports = "warn"
100100
unused_peekable = "warn"
101101
useless_let_if_seq = "warn"
102+
result_large_err = "allow" # TODO: Remove after fixing code.
103+
large_enum_variant = "allow" # TODO: Remove after fixing code.

crates/db/Cargo.toml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
[package]
2+
name = "wcn_db"
3+
version = "0.1.0"
4+
edition = "2021"
5+
publish = false
6+
7+
[lib]
8+
path = "src/lib.rs"
9+
name = "wcn_db"
10+
11+
[[bin]]
12+
path = "src/main.rs"
13+
name = "wcn_db"
14+
15+
[features]
16+
default = ["testing"]
17+
testing = ["storage_api/rpc_client", "wcn_rpc/client"]
18+
19+
[lints]
20+
workspace = true
21+
22+
[dependencies]
23+
wc = { workspace = true, features = ["alloc", "future", "metrics"] }
24+
logging = { package = "wcn_logging", path = "../logging" }
25+
metrics = { workspace = true }
26+
time = { workspace = true }
27+
wcn_rpc = { workspace = true, features = ["server"] }
28+
wcn_rocks = { workspace = true }
29+
storage_api = { package = "wcn_storage_api2", path = "../storage_api2", default-features = false, features = [
30+
"rpc_server",
31+
] }
32+
anyhow = "1"
33+
atty = "0.2"
34+
axum = "0.8"
35+
base64 = "0.20"
36+
derive_more = { workspace = true, features = [
37+
"as_ref",
38+
"display",
39+
"from",
40+
"try_into",
41+
"deref",
42+
] }
43+
derivative = "2"
44+
envy = "0.4"
45+
futures = "0.3"
46+
tokio = { version = "1", default-features = false, features = ["fs", "signal"] }
47+
tokio-util = { version = "0.7", features = ["compat"] }
48+
tokio-stream = "0.1"
49+
serde = "1"
50+
thiserror = "1"
51+
metrics-exporter-prometheus = "0.15"
52+
proc-mounts = "0.3"
53+
sysinfo = "0.29"
54+
tracing = "0.1"
55+
tap = "1.0"
56+
vergen-pretty = { version = "0.3", features = ["trace"] }
57+
xxhash-rust = { version = "0.8", features = ["xxh3", "const_xxh3"] }
58+
59+
[dev-dependencies]
60+
const-hex = "1.14"
61+
rand = "0.9"
62+
rand_chacha = "0.9"
63+
64+
[build-dependencies]
65+
vergen = { version = "8", default-features = false, features = [
66+
"build",
67+
"cargo",
68+
"git",
69+
"gitoxide",
70+
"rustc",
71+
] }

0 commit comments

Comments
 (0)