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

misc: added a client crate that includes the tasks #392

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
108 changes: 108 additions & 0 deletions Cargo.lock

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

12 changes: 11 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@ members = [
"runtime",
"pallets/*",
"node",
"client/*",
"client",
"client/actors-framework",
"client/blockchain-service",
"client/common",
"client/file-manager",
"client/file-transfer-service",
"client/forest-manager",
"client/indexer-db",
"client/indexer-service",
"client/rpc",
"primitives/*",
"xcm-simulator",
]
Expand Down Expand Up @@ -210,6 +219,7 @@ shc-common = { path = "client/common", default-features = false }
shc-file-manager = { path = "client/file-manager", default-features = false }
shc-forest-manager = { path = "client/forest-manager", default-features = false }
shc-rpc = { path = "client/rpc", default-features = false }
shc-client = { path = "client", default-features = false }

# Local - StorageHub Primitives (used by the runtime and the node, must be no_std compatible)
shp-constants = { path = "primitives/constants", default-features = false }
Expand Down
147 changes: 147 additions & 0 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
[package]
name = "shc-client"
version = "0.1.0"
description = "Storage Hub Client."
homepage = { workspace = true }
license = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
edition = { workspace = true }
publish = false

[lib]

[lints]
workspace = true

[dependencies]
anyhow = { workspace = true }
array-bytes = { workspace = true }
async-channel = { workspace = true }
async-io = { workspace = true }
async-trait = { workspace = true }
chrono = { workspace = true }
color-print = { workspace = true }
futures-timer = { workspace = true }
hex = { workspace = true, default-features = true }
kvdb = { workspace = true }
kvdb-rocksdb = { workspace = true }
lazy-static = { workspace = true }
ordered-float = { workspace = true }
priority-queue = { workspace = true }
rand = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
toml = { workspace = true }

# Local
pallet-file-system = { workspace = true }
pallet-file-system-runtime-api = { workspace = true }
pallet-payment-streams = { workspace = true }
pallet-payment-streams-runtime-api = { workspace = true }
pallet-proofs-dealer = { workspace = true }
pallet-proofs-dealer-runtime-api = { workspace = true }
pallet-storage-providers = { workspace = true }
storage-hub-runtime = { workspace = true }
shc-actors-framework = { workspace = true }
shc-blockchain-service = { workspace = true }
shc-file-transfer-service = { workspace = true }
shc-common = { workspace = true }
shc-file-manager = { workspace = true }
shc-forest-manager = { workspace = true }
shc-indexer-db = { workspace = true }
shc-indexer-service = { workspace = true }
shc-rpc = { workspace = true }
shp-constants = { workspace = true }
shp-file-key-verifier = { workspace = true }
shp-file-metadata = { workspace = true }
shp-traits = { workspace = true }

clap = { workspace = true }
log = { workspace = true }
codec = { workspace = true }
serde = { workspace = true, default-features = true }
jsonrpsee = { features = ["server"], workspace = true }
futures = { workspace = true }
serde_json = { workspace = true }

# Substrate
frame-benchmarking = { workspace = true, default-features = true }
frame-benchmarking-cli = { workspace = true }
frame-system = { workspace = true }
frame-support = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-transaction-payment-rpc = { workspace = true }
sc-basic-authorship = { workspace = true }
sc-chain-spec = { workspace = true }
sc-cli = { workspace = true }
sc-client-api = { workspace = true }
sc-offchain = { workspace = true }
sc-consensus = { workspace = true }
sc-consensus-aura = { workspace = true }
sc-consensus-manual-seal = { workspace = true }
sc-executor = { workspace = true }
sc-network = { workspace = true }
sc-network-sync = { workspace = true }
sc-rpc = { workspace = true }
sc-service = { workspace = true }
sc-sysinfo = { workspace = true }
sc-telemetry = { workspace = true }
sc-tracing = { workspace = true }
sc-transaction-pool = { workspace = true }
sc-transaction-pool-api = { workspace = true }
sc-utils = { workspace = true }
sp-api = { workspace = true }
sp-block-builder = { workspace = true }
sp-blockchain = { workspace = true }
sp-consensus-aura = { workspace = true }
sp-core = { workspace = true, default-features = true }
sp-keyring = { workspace = true, default-features = true }
sp-keystore = { workspace = true }
sp-io = { workspace = true, default-features = true }
sp-inherents = { workspace = true }
sp-runtime = { workspace = true, default-features = true }
sp-timestamp = { workspace = true }
sp-trie = { workspace = true }
substrate-frame-rpc-system = { workspace = true }
substrate-prometheus-endpoint = { workspace = true }

# Polkadot
polkadot-cli = { workspace = true }
polkadot-primitives = { workspace = true }
polkadot-runtime-common = { workspace = true }
xcm = { workspace = true }

# Cumulus
cumulus-client-cli = { workspace = true }
cumulus-client-collator = { workspace = true }
cumulus-client-consensus-aura = { workspace = true }
cumulus-client-consensus-common = { workspace = true }
cumulus-client-consensus-proposer = { workspace = true }
cumulus-client-parachain-inherent = { workspace = true }
cumulus-client-service = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-parachain-inherent = { workspace = true }
cumulus-primitives-storage-weight-reclaim = { workspace = true }
cumulus-relay-chain-interface = { workspace = true }

[build-dependencies]
substrate-build-script-utils = { workspace = true }

[features]
default = []
runtime-benchmarks = [
"cumulus-primitives-core/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"storage-hub-runtime/runtime-benchmarks",
]
try-runtime = [
"polkadot-cli/try-runtime",
"sp-runtime/try-runtime",
"storage-hub-runtime/try-runtime",
]
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions node/src/services/handler.rs → client/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ use shc_forest_manager::traits::ForestStorageHandler;
use shc_indexer_db::DbPool;

use crate::{
services::types::{
BspForestStorageHandlerT, BspProvider, MspForestStorageHandlerT, MspProvider, ShNodeType,
ShStorageLayer, UserRole,
},
tasks::{
bsp_charge_fees::BspChargeFeesTask, bsp_delete_file::BspDeleteFileTask,
bsp_download_file::BspDownloadFileTask, bsp_move_bucket::BspMoveBucketTask,
Expand All @@ -43,6 +39,10 @@ use crate::{
msp_upload_file::MspUploadFileTask, sp_slash_provider::SlashProviderTask,
user_sends_file::UserSendsFileTask,
},
types::{
BspForestStorageHandlerT, BspProvider, MspForestStorageHandlerT, MspProvider, ShNodeType,
ShStorageLayer, UserRole,
},
};

/// Configuration parameters for Storage Providers.
Expand Down Expand Up @@ -124,7 +124,7 @@ where
/// This trait is implemented by the different [`StorageHubHandler`] variants,
/// and runs the tasks required to work as a specific [`ShRole`](super::types::ShRole).
pub trait RunnableTasks {
async fn run_tasks(&mut self);
fn run_tasks(&mut self) -> impl std::future::Future<Output = ()> + Send;
}

impl<S: ShStorageLayer> RunnableTasks for StorageHubHandler<(BspProvider, S)>
Expand Down
1 change: 1 addition & 0 deletions node/src/services/mod.rs → client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod builder;
pub mod forest_storage;
pub mod handler;
pub mod tasks;
pub mod types;
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use shc_forest_manager::traits::{ForestStorage, ForestStorageHandler};
use sp_core::{Get, H256};
use storage_hub_runtime::Balance;

use crate::services::{
use crate::{
handler::StorageHubHandler,
types::{BspForestStorageHandlerT, ShNodeType},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use shc_file_manager::traits::FileStorage;
use shc_forest_manager::traits::{ForestStorage, ForestStorageHandler};
use sp_core::H256;

use crate::services::{
use crate::{
handler::StorageHubHandler,
types::{BspForestStorageHandlerT, ShNodeType},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use shc_file_transfer_service::{
commands::FileTransferServiceInterface, events::RemoteDownloadRequest,
};

use crate::services::{
use crate::{
handler::StorageHubHandler,
types::{BspForestStorageHandlerT, ShNodeType},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use shc_blockchain_service::{
};
use shc_file_transfer_service::commands::FileTransferServiceInterface;

use crate::services::{
use crate::{
handler::StorageHubHandler,
types::{BspForestStorageHandlerT, ShNodeType},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use shc_common::{
};
use shc_forest_manager::traits::{ForestStorage, ForestStorageHandler};

use crate::services::{
use crate::{
handler::StorageHubHandler,
types::{BspForestStorageHandlerT, ShNodeType},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use shc_file_transfer_service::{
use shc_forest_manager::traits::{ForestStorage, ForestStorageHandler};
use storage_hub_runtime::MILLIUNIT;

use crate::services::{
use crate::{
handler::StorageHubHandler,
types::{BspForestStorageHandlerT, ShNodeType},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use shc_actors_framework::event_bus::EventHandler;
use shc_blockchain_service::{commands::BlockchainServiceInterface, events::NewStorageRequest};
use sp_core::H256;

use crate::services::{
use crate::{
handler::StorageHubHandler,
types::{BspForestStorageHandlerT, ShNodeType},
};
Expand Down
Loading
Loading