-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ✨ Launch Storage Providers async tasks in Substrate node (#28)
* WIP, provider requests protocol setup * request protocol type changes with proto * refactor: 🚚 Restructure spawned networking task as service * fix: 🔥 Remove unimplemented inherent code that was preventing the parachain from running * test: ✅ Add local testing instructions and configurations with pure zombienet * refactor: 🚚 Make `service` in `node` use the new architecture with the `file_transfer` service * revert: ⏪ Remove `pure_zombie` zombienet config file * chore: 🔪 remove superseded bsp and msp crates * feat: 🔧 add infrastructure crate and Storage trait * feat: port Actor and EventBus infra. Update FileTransferService to use them * fix: Cargo.lock * style: 🎨 Format Cargo.toml files with zepter * refactor: ♻️ Make dependencies in `node` all workspace dependencies * fix FileTransferServive event loop stream merge * fix: revert proto changes and add file watcher in build.rs * feat: integrate events & add emit event mock example --------- Co-authored-by: Michael Assaf <michael.assaf.edge@gmail.com> Co-authored-by: Alexandru Murtaza <alexandru@moonsonglabs.com>
- Loading branch information
1 parent
09b4189
commit a5b227a
Showing
33 changed files
with
1,414 additions
and
411 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[package] | ||
name = "shc-mapping-sync" | ||
description = "Mapping sync logic for StorageHub." | ||
version = "0.1.0" | ||
homepage = { workspace = true } | ||
license = { workspace = true } | ||
authors = { workspace = true } | ||
repository = { workspace = true } | ||
edition = { workspace = true } | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[dependencies] | ||
futures = { workspace = true } | ||
futures-timer = "3.0.3" | ||
log = { workspace = true } | ||
parking_lot = { workspace = true } | ||
tokio = { workspace = true, features = ["macros", "sync"], optional = true } | ||
|
||
# Substrate | ||
sc-client-api = { workspace = true } | ||
sc-utils = { workspace = true } | ||
sp-api = { workspace = true } | ||
sp-blockchain = { workspace = true } | ||
sp-consensus = { workspace = true, features = ["default"] } | ||
sp-core = { workspace = true, optional = true } | ||
sp-runtime = { workspace = true } | ||
|
||
[dev-dependencies] | ||
# Substrate | ||
sp-core = { workspace = true, features = ["default"] } | ||
sp-io = { workspace = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use sp_runtime::traits::Block as BlockT; | ||
|
||
pub type StorageHubBlockNotificationSinks<T> = | ||
parking_lot::Mutex<Vec<sc_utils::mpsc::TracingUnboundedSender<T>>>; | ||
|
||
#[derive(Copy, Clone, Debug, Eq, PartialEq)] | ||
pub struct StorageHubBlockNotification<Block: BlockT> { | ||
pub is_new_best: bool, | ||
pub hash: Block::Hash, | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed}; | ||
|
||
const PROTOS: &[&str] = &["src/services/file_transfer/schema/provider.v1.proto"]; | ||
|
||
fn main() { | ||
generate_cargo_keys(); | ||
|
||
// Tell Cargo to rerun this build script whenever the proto files change. | ||
PROTOS.iter().for_each(|proto| { | ||
println!("cargo:rerun-if-changed={}", proto); | ||
}); | ||
|
||
rerun_if_git_head_changed(); | ||
|
||
prost_build::compile_protos(PROTOS, &["src/services/file_transfer/schema"]).unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use storage_hub_infra::event_bus::{EventBus, EventBusMessage, ProvidesEventBus}; | ||
|
||
#[derive(Clone, Debug, Default)] | ||
pub struct FileTransferServiceEventBusProvider { | ||
remote_upload_request_event_bus: EventBus<RemoteUploadRequest>, | ||
} | ||
|
||
impl FileTransferServiceEventBusProvider { | ||
pub fn new() -> Self { | ||
Self { | ||
remote_upload_request_event_bus: EventBus::new(), | ||
} | ||
} | ||
} | ||
|
||
impl ProvidesEventBus<RemoteUploadRequest> for FileTransferServiceEventBusProvider { | ||
fn event_bus(&self) -> &EventBus<RemoteUploadRequest> { | ||
&self.remote_upload_request_event_bus | ||
} | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct RemoteUploadRequest { | ||
pub location: String, | ||
} | ||
|
||
impl EventBusMessage for RemoteUploadRequest {} |
Oops, something went wrong.