Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
5035f18a
Commit
5035f18a
authored
6 years ago
by
Arkadiy Paronyan
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Specialized network() (#352)
parent
07fbd871
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/polkadot/service/src/lib.rs
+8
-0
8 additions, 0 deletions
substrate/polkadot/service/src/lib.rs
with
8 additions
and
0 deletions
substrate/polkadot/service/src/lib.rs
+
8
−
0
View file @
5035f18a
...
...
@@ -60,6 +60,7 @@ pub use client::ExecutionStrategy;
pub
type
ChainSpec
=
service
::
ChainSpec
<
GenesisConfig
>
;
/// Polkadot client type for specialised `Components`.
pub
type
ComponentClient
<
C
>
=
Client
<<
C
as
Components
>
::
Backend
,
<
C
as
Components
>
::
Executor
,
Block
>
;
pub
type
NetworkService
=
network
::
Service
<
Block
,
<
Factory
as
service
::
ServiceFactory
>
::
NetworkProtocol
>
;
/// A collection of type to generalise Polkadot specific components over full / light client.
pub
trait
Components
:
service
::
Components
{
...
...
@@ -134,6 +135,7 @@ impl service::ServiceFactory for Factory {
pub
struct
Service
<
C
:
Components
>
{
inner
:
service
::
Service
<
C
>
,
client
:
Arc
<
ComponentClient
<
C
>>
,
network
:
Arc
<
NetworkService
>
,
api
:
Arc
<<
C
as
Components
>
::
Api
>
,
_consensus
:
Option
<
consensus
::
Service
>
,
}
...
...
@@ -143,6 +145,10 @@ impl <C: Components> Service<C> {
self
.client
.clone
()
}
pub
fn
network
(
&
self
)
->
Arc
<
NetworkService
>
{
self
.network
.clone
()
}
pub
fn
api
(
&
self
)
->
Arc
<<
C
as
Components
>
::
Api
>
{
self
.api
.clone
()
}
...
...
@@ -156,6 +162,7 @@ pub fn new_light(config: Configuration<GenesisConfig>, executor: TaskExecutor)
let
api
=
Arc
::
new
(
RemotePolkadotApiWrapper
(
service
.client
()));
Ok
(
Service
{
client
:
service
.client
(),
network
:
service
.network
(),
api
:
api
,
inner
:
service
,
_consensus
:
None
,
...
...
@@ -192,6 +199,7 @@ pub fn new_full(config: Configuration<GenesisConfig>, executor: TaskExecutor)
Ok
(
Service
{
client
:
service
.client
(),
network
:
service
.network
(),
api
:
service
.client
(),
inner
:
service
,
_consensus
:
consensus
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment