Skip to content

Commit cd1a29f

Browse files
nazar-pcniklasad1
andauthored
Export more from sc-service (paritytech#5250)
Follow-up to paritytech#4457, looks like more things were missing --------- Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
1 parent 34e64c7 commit cd1a29f

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

prdoc/pr_5250.prdoc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
title: Export `MetricsService` and add public constructor to `RpcHandlers`
2+
3+
doc:
4+
- audience: Node Dev
5+
description: |
6+
`sc-service` was missing just a couple of things in public API in order to make it possible to recreate its
7+
`spawn_tasks`, specifically `MetricsService` struct and `RpcHandlers` didn't have public constructor, which were
8+
both finally addressed.
9+
10+
crates:
11+
- name: sc-service
12+
bump: patch

substrate/client/service/src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ where
509509
};
510510

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

514514
// Spawn informant task
515515
spawn_handle.spawn(

substrate/client/service/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ pub use self::{
6262
},
6363
client::{ClientConfig, LocalCallExecutor},
6464
error::Error,
65+
metrics::MetricsService,
6566
};
6667
#[allow(deprecated)]
6768
pub use builder::new_native_or_wasm_executor;
@@ -101,6 +102,11 @@ const DEFAULT_PROTOCOL_ID: &str = "sup";
101102
pub struct RpcHandlers(Arc<RpcModule<()>>);
102103

103104
impl RpcHandlers {
105+
/// Create PRC handlers instance.
106+
pub fn new(inner: Arc<RpcModule<()>>) -> Self {
107+
Self(inner)
108+
}
109+
104110
/// Starts an RPC query.
105111
///
106112
/// The query is passed as a string and must be valid JSON-RPC request object.

0 commit comments

Comments
 (0)