Skip to content

Commit df52e86

Browse files
authored
Feat/support for dms node dashboard (#575)
* feat: add doc store * feat: add index * test: add index test case * fix: update the error report * feat: upgrade version * fix: revert the key and case
1 parent 8875059 commit df52e86

File tree

12 files changed

+36
-35
lines changed

12 files changed

+36
-35
lines changed

sdk/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "db3.js",
3-
"version": "0.3.18",
3+
"version": "0.4.0",
44
"description": "DB3 Network Javascript API",
55
"author": "dbpunk labs",
66
"keywords": [

src/base/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "db3-base"
3-
version = "0.1.0"
3+
version = "0.4.0"
44
edition = "2021"
55
authors = ["jack wang <jackwang@db3.network>"]
66
description = "base module of db3"
@@ -12,8 +12,8 @@ keywords = ["database", "web3", "db3"]
1212
ethereum-types = { version = "0.14.0", default-features = false }
1313
hex = "0.4.3"
1414
fastcrypto="0.1.3"
15-
db3-proto={path="../proto", version="0.1.0"}
16-
db3-error={path="../error", version="0.1.0"}
15+
db3-proto={path="../proto"}
16+
db3-error={path="../error"}
1717
rand = "0.8.5"
1818
bson = "2.5.0"
1919
serde_json = {workspace=true}

src/cmd/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "db3-cmd"
3-
version = "0.1.0"
3+
version = "0.4.0"
44
edition = "2021"
55
authors = ["jack wang <jackwang@db3.network>"]
66
description = "cmd module of db3"

src/crypto/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "db3-crypto"
3-
version = "0.1.0"
3+
version = "0.4.0"
44
edition = "2021"
55
authors = ["jack wang <jackwang@db3.network>"]
66
description = "crypto module of db3"

src/error/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ pub enum DB3Error {
137137

138138
#[error("database with addr {0} was not found")]
139139
DatabaseNotFound(String),
140-
140+
#[error("database with addr {0} already exist")]
141+
DatabaseAlreadyExist(String),
141142
#[error("collection with name {0} was not found in db {1}")]
142143
CollectionNotFound(String, String),
143144
#[error("collection {0} already exist in db {1}")]

src/event/Cargo.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
[package]
22
name = "db3-event"
3-
version = "0.1.0"
3+
version = "0.4.0"
44
edition = "2021"
55

66
[dependencies]
77
ethers = { workspace = true , features=["ws"]}
88
tracing = "0.1"
9-
db3-error={path="../error", version="0.1.0"}
10-
db3-crypto={path="../crypto", version="0.1.0"}
11-
db3-proto={path="../proto", version="0.1.0"}
9+
db3-error={path="../error"}
10+
db3-crypto={path="../crypto"}
11+
db3-proto={path="../proto"}
1212
serde_json = { workspace=true}
1313
bytes = "1"
1414
prost = "0.11"
1515
prost-types = "0.11"
16-
db3-storage={path="../storage", version="0.1.0"}
16+
db3-storage={path="../storage"}
1717
ethabi = { version = "18.0.0", default-features = false, features = ["full-serde", "rlp"] }
1818
hex = "0.4.3"
1919
tokio = { version = "1.17.0", features = ["full"] }

src/node/Cargo.toml

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "db3-node"
3-
version = "0.1.0"
3+
version = "0.4.0"
44
edition = "2021"
55

66
[[bin]]
@@ -10,14 +10,14 @@ path = "src/main.rs"
1010
[dependencies]
1111
bytes = { version = "1.4", default-features = false }
1212
flex-error = { version = "0.4.4", default-features = false }
13-
db3-proto={path="../proto", version="0.1.0"}
14-
db3-crypto={path="../crypto", version="0.1.0"}
15-
db3-storage={path="../storage", version="0.1.0"}
16-
db3-base={path="../base", version="0.1.0"}
17-
db3-error={path="../error", version="0.1.0"}
18-
db3-cmd={path="../cmd", version="0.1.0"}
19-
db3-sdk={path="../sdk", version="0.1.0"}
20-
db3-event={path="../event", version="0.1.0"}
13+
db3-proto={path="../proto"}
14+
db3-crypto={path="../crypto"}
15+
db3-storage={path="../storage"}
16+
db3-base={path="../base"}
17+
db3-error={path="../error"}
18+
db3-cmd={path="../cmd"}
19+
db3-sdk={path="../sdk"}
20+
db3-event={path="../event"}
2121
ethers = { workspace = true }
2222
tonic = { workspace = true }
2323
tonic-web = { workspace = true }

src/node/src/system_impl.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
use crate::mutation_utils::MutationUtil;
1919
use crate::version_util;
20+
use db3_crypto::db3_address::DB3Address;
2021
use db3_error::{DB3Error, Result};
2122
use db3_proto::db3_base_proto::SystemConfig;
2223
use db3_proto::db3_base_proto::SystemStatus;
@@ -186,6 +187,8 @@ impl System for SystemImpl {
186187
.get_ar_address()
187188
.map_err(|e| Status::internal(format!("fail to get ar address {e}")))?;
188189
let readable_addr = hex::encode(evm_address);
190+
let db3_addr = DB3Address::try_from(self.admin_addr.0.as_ref())
191+
.map_err(|e| Status::internal(format!("fail to convert the admin address {e}")))?;
189192
Ok(Response::new(SystemStatus {
190193
evm_account: format!("0x{}", readable_addr),
191194
evm_balance: "".to_string(),
@@ -194,7 +197,7 @@ impl System for SystemImpl {
194197
node_url: self.public_node_url.to_string(),
195198
config: system_config,
196199
has_inited,
197-
admin_addr: self.admin_addr.to_string(),
200+
admin_addr: db3_addr.to_hex(),
198201
version: Some(version_util::build_version()),
199202
}))
200203
}

src/proto/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "db3-proto"
3-
version = "0.1.0"
3+
version = "0.4.0"
44
edition = "2021"
55
authors = ["jack wang <jackwang@db3.network>"]
66
description = "proto module of db3"

src/sdk/Cargo.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "db3-sdk"
3-
version = "0.1.0"
3+
version = "0.4.0"
44
edition = "2021"
55
authors = ["jack wang <jackwang@db3.network>"]
66
description = "sdk module of db3"
@@ -10,9 +10,9 @@ keywords = ["database", "web3", "db3"]
1010

1111
[dependencies]
1212
ethers = { workspace = true }
13-
db3-proto={path="../proto", version="0.1.0"}
14-
db3-error={path="../error", version="0.1.0"}
15-
db3-crypto={path="../crypto", version="0.1.0"}
13+
db3-proto={path="../proto"}
14+
db3-error={path="../error"}
15+
db3-crypto={path="../crypto"}
1616
bytes = { version = "1.0", default-features = false }
1717
tokio = { version = "1.17.0", features = ["full"] }
1818
tonic = { workspace=true, features = ["tls-roots"]}
@@ -24,8 +24,8 @@ rand = "0.8.5"
2424
serde_json = {workspace=true}
2525
hex = "0.4.3"
2626
[dev-dependencies]
27-
db3-base={path="../base", version="0.1.0"}
28-
db3-cmd={path="../cmd", version="0.1.0"}
27+
db3-base={path="../base"}
28+
db3-cmd={path="../cmd" }
2929
criterion = { version = "0.3.4", default-features = false,features = ["async_futures", "async_tokio"]}
3030
[[bench]]
3131
name = "sdk_benchmark"

src/storage/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "db3-storage"
3-
version = "0.1.0"
3+
version = "0.4.0"
44
edition = "2021"
55
authors = ["jack wang <jackwang@db3.network>"]
66
description = "storage module of db3"

src/storage/src/db_store_v2.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -888,10 +888,7 @@ impl DBStoreV2 {
888888
order: u32,
889889
) -> Result<()> {
890890
if let Ok(Some(_)) = self.get_database(db_addr.address()) {
891-
return Err(DB3Error::WriteStoreError(format!(
892-
"database with address {} exists",
893-
db_addr.to_hex()
894-
)));
891+
return Err(DB3Error::DatabaseAlreadyExist(db_addr.to_hex()));
895892
}
896893
let db_store_cf_handle = self
897894
.se
@@ -1200,7 +1197,7 @@ impl DBStoreV2 {
12001197
doc_ids_map.get(i.to_string().as_str()),
12011198
)
12021199
.map_err(|e| DB3Error::ApplyMutationError(format!("{e}")))?;
1203-
info!(
1200+
debug!(
12041201
"add documents with db_addr {}, collection_name: {}, from owner {}, document size: {}",
12051202
db_addr.to_hex().as_str(),
12061203
doc_mutation.collection_name.as_str(),

0 commit comments

Comments
 (0)