Skip to content

Commit

Permalink
(#78) Network Viewer - New Suibase.toml for package management
Browse files Browse the repository at this point in the history
  • Loading branch information
mario4tier committed Oct 21, 2023
1 parent 1b9b167 commit ada0997
Show file tree
Hide file tree
Showing 30 changed files with 6,188 additions and 9,960 deletions.
15,199 changes: 5,595 additions & 9,604 deletions rust/demo-app/Cargo.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions rust/demo-app/move/Suibase.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[meta]
creation_timestamp = "1697828010924574 2023-10-20 14:53:30.924574678 -04:00"

[packages]
demo = { output_dir = "HPDM7J4PRD6OTJTGEMMPTFN2TM", output_dir_custom = false }
48 changes: 43 additions & 5 deletions rust/suibase/Cargo.lock

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

4 changes: 3 additions & 1 deletion rust/suibase/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ version = "0.0.3"
edition = "2021"

[workspace.dependencies]

data-encoding = "2.4.0"
chrono = "0.4.31"
futures = "0.3.25"

jsonrpsee = { git = "https://github.com/wlmyng/jsonrpsee.git", rev = "b1b300784795f6a64d0fcdf8f03081a9bc38bde8", features = [
Expand All @@ -18,6 +19,7 @@ jsonrpsee = { git = "https://github.com/wlmyng/jsonrpsee.git", rev = "b1b3007847
"jsonrpsee-core",
] }
jsonrpsee-proc-macros = { git = "https://github.com/wlmyng/jsonrpsee.git", rev = "b1b300784795f6a64d0fcdf8f03081a9bc38bde8" }
md5 = "0.7"
schemars = { version = "0.8.10", features = ["either"] }
serde_with = { version = "2.1.0", features = ["hex"] }
serde_json = { version = "1.0.95", features = [
Expand Down
4 changes: 4 additions & 0 deletions rust/suibase/crates/suibase-daemon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mime = "0.3.16"

memchr = "2.5.0"

toml_edit = { version = "0.20.0" }

tokio.workspace = true
tokio-graceful-shutdown.workspace = true
Expand All @@ -28,6 +29,9 @@ notify = { version = "6.0", default-features = false, features = [
"macos_kqueue",
] }

data-encoding.workspace = true
md5.workspace = true
chrono.workspace = true
uuid.workspace = true
uuid7.workspace = true
anyhow.workspace = true
Expand Down
11 changes: 4 additions & 7 deletions rust/suibase/crates/suibase-daemon/src/admin_controller.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
use std::fmt::Debug;
use std::vec;

use crate::basic_types::*;

use crate::network_monitor::NetMonTx;
use crate::proxy_server::ProxyServer;
use crate::shared_types::{
Globals, GlobalsProxyMT, GlobalsStatusMT, GlobalsWorkdirsMT, GlobalsWorkdirsST, InputPort,
WorkdirProxyConfig,
};
use crate::shared_types::{Globals, InputPort, WorkdirProxyConfig};
use crate::workdirs_watcher::WorkdirsWatcher;
use crate::workers::ShellWorker;

Expand Down Expand Up @@ -463,6 +457,9 @@ impl ManagedElement for AdminController {
}
}

#[cfg(test)]
use crate::shared_types::GlobalsWorkdirsST;

#[test]
fn test_load_config_from_suibase_default() {
// Note: More of a functional test. Suibase need to be installed.
Expand Down
16 changes: 6 additions & 10 deletions rust/suibase/crates/suibase-daemon/src/api/api_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,26 @@
// A JSONRPCServer owns a jsonrpsee Server to handle the JSON-RPC requests.
// ( https://github.com/paritytech/jsonrpsee )

use reqwest::Proxy;
use tokio::time::{interval, Duration};
use tokio::time::Duration;

use anyhow::Result;
use tokio_graceful_shutdown::{FutureExt, SubsystemHandle, Toplevel};

use crate::{
admin_controller::AdminControllerTx,
shared_types::{Globals, GlobalsProxyMT, GlobalsStatusMT},
};
use crate::{admin_controller::AdminControllerTx, shared_types::Globals};

use super::GeneralApiServer;
use crate::api::impl_general_api::GeneralApiImpl;

use super::ProxyApiServer;
use crate::api::impl_proxy_api::ProxyApiImpl;

use super::ModulesApiServer;
use crate::api::impl_modules_api::ModulesApiImpl;
use super::PackagesApiServer;
use crate::api::impl_packages_api::PackagesApiImpl;

use hyper::Method;
use jsonrpsee::{
core::server::rpc_module::Methods,
server::{AllowHosts, RpcModule, Server, ServerBuilder},
server::{AllowHosts, ServerBuilder},
};
use std::net::SocketAddr;
use tower_http::cors::{Any, CorsLayer};
Expand Down Expand Up @@ -139,7 +135,7 @@ impl JSONRPCServer {
}

{
let api = ModulesApiImpl::new(self.globals.clone(), self.admctrl_tx.clone());
let api = PackagesApiImpl::new(self.globals.clone(), self.admctrl_tx.clone());
let methods = api.into_rpc();
if let Err(e) = all_methods.merge(methods) {
log::error!("Error merging ModulesApiImpl methods: {}", e);
Expand Down
5 changes: 2 additions & 3 deletions rust/suibase/crates/suibase-daemon/src/api/def_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ impl<T: Clone + PartialEq> Versioned<T> {

// Write version into a Header structure.
pub fn init_header_uuids(&self, header: &mut Header) {
let (method_uuid, data_uuid) = self.uuid.get();
header.method_uuid = Some(method_uuid.to_string());
header.data_uuid = Some(data_uuid.to_string());
header.method_uuid = Some(self.uuid.get_method_uuid());
header.data_uuid = Some(self.uuid.get_data_uuid());
}
}
Loading

0 comments on commit ada0997

Please sign in to comment.