sc_service/client/mod.rs
1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
5
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19//! Substrate Client and associated logic.
20//!
21//! The [`Client`] is one of the most important components of Substrate. It mainly comprises two
22//! parts:
23//!
24//! - A database containing the blocks and chain state, generally referred to as
25//! the [`Backend`](sc_client_api::backend::Backend).
26//! - A runtime environment, generally referred to as the
27//! [`Executor`](sc_client_api::call_executor::CallExecutor).
28//!
29//! # Initialization
30//!
31//! Creating a [`Client`] is done by calling the `new` method and passing to it a
32//! [`Backend`](sc_client_api::backend::Backend) and an
33//! [`Executor`](sc_client_api::call_executor::CallExecutor).
34//!
35//! The former is typically provided by the `sc-client-db` crate.
36//!
37//! The latter typically requires passing one of:
38//!
39//! - A [`LocalCallExecutor`] running the runtime locally.
40//! - A `RemoteCallExecutor` that will ask a third-party to perform the executions.
41//! - A `RemoteOrLocalCallExecutor` combination of the two.
42//!
43//! Additionally, the fourth generic parameter of the `Client` is a marker type representing
44//! the ways in which the runtime can interface with the outside. Any code that builds a `Client`
45//! is responsible for putting the right marker.
46
47mod block_rules;
48mod call_executor;
49mod client;
50mod code_provider;
51mod notification_pinning;
52mod wasm_override;
53mod wasm_substitutes;
54
55pub use call_executor::LocalCallExecutor;
56pub use client::{Client, ClientConfig};
57pub(crate) use code_provider::CodeProvider;
58
59pub use self::client::new_with_backend;