Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Remove ServiceBuilderCommand and implement the chain ops as standalone functions instead. #6543

Merged
merged 14 commits into from
Jul 2, 2020
Merged
12 changes: 6 additions & 6 deletions client/cli/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl<C: SubstrateCli> Runner<C> {
-> Result<()>
where
BU: FnOnce(Configuration)
-> sc_service::error::Result<(Arc<CL>, Arc<BA>, IQ)>,
-> sc_service::error::Result<(Arc<CL>, Arc<BA>, IQ, TaskManager)>,
B: BlockT + for<'de> serde::Deserialize<'de>,
BA: sc_client_api::backend::Backend<B> + 'static,
IQ: sc_service::ImportQueue<B> + 'static,
Expand All @@ -195,24 +195,24 @@ impl<C: SubstrateCli> Runner<C> {
match subcommand {
Subcommand::BuildSpec(cmd) => cmd.run(chain_spec, network_config),
Subcommand::ExportBlocks(cmd) => {
let (client, _, _) = builder(self.config)?;
let (client, _, _, _) = builder(self.config)?;
run_until_exit(self.tokio_runtime, cmd.run(client, db_config))
}
Subcommand::ImportBlocks(cmd) => {
let (client, _, import_queue) = builder(self.config)?;
let (client, _, import_queue, _task_manager) = builder(self.config)?;
cecton marked this conversation as resolved.
Show resolved Hide resolved
run_until_exit(self.tokio_runtime, cmd.run(client, import_queue))
}
Subcommand::CheckBlock(cmd) => {
let (client, _, import_queue) = builder(self.config)?;
let (client, _, import_queue, _task_manager) = builder(self.config)?;
run_until_exit(self.tokio_runtime, cmd.run(client, import_queue))
}
Subcommand::Revert(cmd) => {
let (client, backend, _) = builder(self.config)?;
let (client, backend, _, _) = builder(self.config)?;
cmd.run(client, backend)
},
Subcommand::PurgeChain(cmd) => cmd.run(db_config),
Subcommand::ExportState(cmd) => {
let (client, _, _) = builder(self.config)?;
let (client, _, _, _) = builder(self.config)?;
cmd.run(client, chain_spec)
},
}
Expand Down
4 changes: 2 additions & 2 deletions client/service/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,8 @@ impl<TBl, TRtApi, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend>
}

/// Consume the builder and return the parts needed for chain operations.
pub fn to_chain_ops_parts(self) -> (Arc<TCl>, Arc<Backend>, TImpQu) {
(self.client, self.backend, self.import_queue)
pub fn to_chain_ops_parts(self) -> (Arc<TCl>, Arc<Backend>, TImpQu, TaskManager) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add a special method for this?

What happens if I require more next week? Maybe the tx pool? Can we not just call build add take what we need?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import queue gets consumed in build, so we need to get it out before that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is only temporary, and will only be here until I remove the service builder.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay 👍

(self.client, self.backend, self.import_queue, self.task_manager)
}

/// Defines which head-of-chain strategy to use.
Expand Down