Skip to content

Commit

Permalink
Feat/support for dms node dashboard (#575)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
imotai authored Jul 25, 2023
1 parent 8875059 commit df52e86
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 35 deletions.
2 changes: 1 addition & 1 deletion sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "db3.js",
"version": "0.3.18",
"version": "0.4.0",
"description": "DB3 Network Javascript API",
"author": "dbpunk labs",
"keywords": [
Expand Down
6 changes: 3 additions & 3 deletions src/base/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "db3-base"
version = "0.1.0"
version = "0.4.0"
edition = "2021"
authors = ["jack wang <jackwang@db3.network>"]
description = "base module of db3"
Expand All @@ -12,8 +12,8 @@ keywords = ["database", "web3", "db3"]
ethereum-types = { version = "0.14.0", default-features = false }
hex = "0.4.3"
fastcrypto="0.1.3"
db3-proto={path="../proto", version="0.1.0"}
db3-error={path="../error", version="0.1.0"}
db3-proto={path="../proto"}
db3-error={path="../error"}
rand = "0.8.5"
bson = "2.5.0"
serde_json = {workspace=true}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "db3-cmd"
version = "0.1.0"
version = "0.4.0"
edition = "2021"
authors = ["jack wang <jackwang@db3.network>"]
description = "cmd module of db3"
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "db3-crypto"
version = "0.1.0"
version = "0.4.0"
edition = "2021"
authors = ["jack wang <jackwang@db3.network>"]
description = "crypto module of db3"
Expand Down
3 changes: 2 additions & 1 deletion src/error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ pub enum DB3Error {

#[error("database with addr {0} was not found")]
DatabaseNotFound(String),

#[error("database with addr {0} already exist")]
DatabaseAlreadyExist(String),
#[error("collection with name {0} was not found in db {1}")]
CollectionNotFound(String, String),
#[error("collection {0} already exist in db {1}")]
Expand Down
10 changes: 5 additions & 5 deletions src/event/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[package]
name = "db3-event"
version = "0.1.0"
version = "0.4.0"
edition = "2021"

[dependencies]
ethers = { workspace = true , features=["ws"]}
tracing = "0.1"
db3-error={path="../error", version="0.1.0"}
db3-crypto={path="../crypto", version="0.1.0"}
db3-proto={path="../proto", version="0.1.0"}
db3-error={path="../error"}
db3-crypto={path="../crypto"}
db3-proto={path="../proto"}
serde_json = { workspace=true}
bytes = "1"
prost = "0.11"
prost-types = "0.11"
db3-storage={path="../storage", version="0.1.0"}
db3-storage={path="../storage"}
ethabi = { version = "18.0.0", default-features = false, features = ["full-serde", "rlp"] }
hex = "0.4.3"
tokio = { version = "1.17.0", features = ["full"] }
Expand Down
18 changes: 9 additions & 9 deletions src/node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "db3-node"
version = "0.1.0"
version = "0.4.0"
edition = "2021"

[[bin]]
Expand All @@ -10,14 +10,14 @@ path = "src/main.rs"
[dependencies]
bytes = { version = "1.4", default-features = false }
flex-error = { version = "0.4.4", default-features = false }
db3-proto={path="../proto", version="0.1.0"}
db3-crypto={path="../crypto", version="0.1.0"}
db3-storage={path="../storage", version="0.1.0"}
db3-base={path="../base", version="0.1.0"}
db3-error={path="../error", version="0.1.0"}
db3-cmd={path="../cmd", version="0.1.0"}
db3-sdk={path="../sdk", version="0.1.0"}
db3-event={path="../event", version="0.1.0"}
db3-proto={path="../proto"}
db3-crypto={path="../crypto"}
db3-storage={path="../storage"}
db3-base={path="../base"}
db3-error={path="../error"}
db3-cmd={path="../cmd"}
db3-sdk={path="../sdk"}
db3-event={path="../event"}
ethers = { workspace = true }
tonic = { workspace = true }
tonic-web = { workspace = true }
Expand Down
5 changes: 4 additions & 1 deletion src/node/src/system_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

use crate::mutation_utils::MutationUtil;
use crate::version_util;
use db3_crypto::db3_address::DB3Address;
use db3_error::{DB3Error, Result};
use db3_proto::db3_base_proto::SystemConfig;
use db3_proto::db3_base_proto::SystemStatus;
Expand Down Expand Up @@ -186,6 +187,8 @@ impl System for SystemImpl {
.get_ar_address()
.map_err(|e| Status::internal(format!("fail to get ar address {e}")))?;
let readable_addr = hex::encode(evm_address);
let db3_addr = DB3Address::try_from(self.admin_addr.0.as_ref())
.map_err(|e| Status::internal(format!("fail to convert the admin address {e}")))?;
Ok(Response::new(SystemStatus {
evm_account: format!("0x{}", readable_addr),
evm_balance: "".to_string(),
Expand All @@ -194,7 +197,7 @@ impl System for SystemImpl {
node_url: self.public_node_url.to_string(),
config: system_config,
has_inited,
admin_addr: self.admin_addr.to_string(),
admin_addr: db3_addr.to_hex(),
version: Some(version_util::build_version()),
}))
}
Expand Down
2 changes: 1 addition & 1 deletion src/proto/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "db3-proto"
version = "0.1.0"
version = "0.4.0"
edition = "2021"
authors = ["jack wang <jackwang@db3.network>"]
description = "proto module of db3"
Expand Down
12 changes: 6 additions & 6 deletions src/sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "db3-sdk"
version = "0.1.0"
version = "0.4.0"
edition = "2021"
authors = ["jack wang <jackwang@db3.network>"]
description = "sdk module of db3"
Expand All @@ -10,9 +10,9 @@ keywords = ["database", "web3", "db3"]

[dependencies]
ethers = { workspace = true }
db3-proto={path="../proto", version="0.1.0"}
db3-error={path="../error", version="0.1.0"}
db3-crypto={path="../crypto", version="0.1.0"}
db3-proto={path="../proto"}
db3-error={path="../error"}
db3-crypto={path="../crypto"}
bytes = { version = "1.0", default-features = false }
tokio = { version = "1.17.0", features = ["full"] }
tonic = { workspace=true, features = ["tls-roots"]}
Expand All @@ -24,8 +24,8 @@ rand = "0.8.5"
serde_json = {workspace=true}
hex = "0.4.3"
[dev-dependencies]
db3-base={path="../base", version="0.1.0"}
db3-cmd={path="../cmd", version="0.1.0"}
db3-base={path="../base"}
db3-cmd={path="../cmd" }
criterion = { version = "0.3.4", default-features = false,features = ["async_futures", "async_tokio"]}
[[bench]]
name = "sdk_benchmark"
Expand Down
2 changes: 1 addition & 1 deletion src/storage/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "db3-storage"
version = "0.1.0"
version = "0.4.0"
edition = "2021"
authors = ["jack wang <jackwang@db3.network>"]
description = "storage module of db3"
Expand Down
7 changes: 2 additions & 5 deletions src/storage/src/db_store_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -888,10 +888,7 @@ impl DBStoreV2 {
order: u32,
) -> Result<()> {
if let Ok(Some(_)) = self.get_database(db_addr.address()) {
return Err(DB3Error::WriteStoreError(format!(
"database with address {} exists",
db_addr.to_hex()
)));
return Err(DB3Error::DatabaseAlreadyExist(db_addr.to_hex()));
}
let db_store_cf_handle = self
.se
Expand Down Expand Up @@ -1200,7 +1197,7 @@ impl DBStoreV2 {
doc_ids_map.get(i.to_string().as_str()),
)
.map_err(|e| DB3Error::ApplyMutationError(format!("{e}")))?;
info!(
debug!(
"add documents with db_addr {}, collection_name: {}, from owner {}, document size: {}",
db_addr.to_hex().as_str(),
doc_mutation.collection_name.as_str(),
Expand Down

0 comments on commit df52e86

Please sign in to comment.