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

Export more from sc-service #5250

Merged
merged 4 commits into from
Aug 7, 2024
Merged
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
12 changes: 12 additions & 0 deletions prdoc/pr_5250.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
title: Export `MetricsService` and add public constructor to `RpcHandlers`

doc:
- audience: Node Dev
description: |
`sc-service` was missing just a couple of things in public API in order to make it possible to recreate its
`spawn_tasks`, specifically `MetricsService` struct and `RpcHandlers` didn't have public constructor, which were
both finally addressed.

crates:
- name: sc-service
bump: patch
2 changes: 1 addition & 1 deletion substrate/client/service/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ where
};

let rpc = start_rpc_servers(&config, gen_rpc_module, rpc_id_provider)?;
let rpc_handlers = RpcHandlers(Arc::new(gen_rpc_module(sc_rpc::DenyUnsafe::No)?.into()));
let rpc_handlers = RpcHandlers::new(Arc::new(gen_rpc_module(sc_rpc::DenyUnsafe::No)?.into()));

// Spawn informant task
spawn_handle.spawn(
Expand Down
6 changes: 6 additions & 0 deletions substrate/client/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub use self::{
},
client::{ClientConfig, LocalCallExecutor},
error::Error,
metrics::MetricsService,
};
#[allow(deprecated)]
pub use builder::new_native_or_wasm_executor;
Expand Down Expand Up @@ -101,6 +102,11 @@ const DEFAULT_PROTOCOL_ID: &str = "sup";
pub struct RpcHandlers(Arc<RpcModule<()>>);

impl RpcHandlers {
/// Create PRC handlers instance.
pub fn new(inner: Arc<RpcModule<()>>) -> Self {
Self(inner)
}

/// Starts an RPC query.
///
/// The query is passed as a string and must be valid JSON-RPC request object.
Expand Down
Loading