Struct sc_authority_discovery::Worker [−][src]
pub struct Worker<Client, Network, Block, DhtEventStream> { /* fields omitted */ }
Expand description
An authority discovery Worker
can publish the local node’s addresses as well as discover
those of other nodes via a Kademlia DHT.
When constructed with Role::PublishAndDiscover
a Worker
will
-
Retrieve its external addresses (including peer id).
-
Get the list of keys owned by the local node participating in the current authority set.
-
Sign the addresses with the keys.
-
Put addresses and signature as a record with the authority id as a key on a Kademlia DHT.
When constructed with either Role::PublishAndDiscover
or Role::Discover
a Worker
will
-
Retrieve the current and next set of authorities.
-
Start DHT queries for the ids of the authorities.
-
Validate the signatures of the retrieved key value pairs.
-
Add the retrieved external addresses as priority nodes to the network peerset.
-
Allow querying of the collected addresses via the
crate::Service
.
Implementations
impl<Client, Network, Block, DhtEventStream> Worker<Client, Network, Block, DhtEventStream> where
Block: BlockT + Unpin + 'static,
Network: NetworkProvider,
Client: ProvideRuntimeApi<Block> + Send + Sync + 'static + HeaderBackend<Block>,
<Client as ProvideRuntimeApi<Block>>::Api: AuthorityDiscoveryApi<Block>,
DhtEventStream: Stream<Item = DhtEvent> + Unpin,
impl<Client, Network, Block, DhtEventStream> Worker<Client, Network, Block, DhtEventStream> where
Block: BlockT + Unpin + 'static,
Network: NetworkProvider,
Client: ProvideRuntimeApi<Block> + Send + Sync + 'static + HeaderBackend<Block>,
<Client as ProvideRuntimeApi<Block>>::Api: AuthorityDiscoveryApi<Block>,
DhtEventStream: Stream<Item = DhtEvent> + Unpin,
Auto Trait Implementations
impl<Client, Network, Block, DhtEventStream> !RefUnwindSafe for Worker<Client, Network, Block, DhtEventStream>
impl<Client, Network, Block, DhtEventStream> Send for Worker<Client, Network, Block, DhtEventStream> where
Block: Send,
Client: Send + Sync,
DhtEventStream: Send,
Network: Send + Sync,
impl<Client, Network, Block, DhtEventStream> Sync for Worker<Client, Network, Block, DhtEventStream> where
Block: Sync,
Client: Send + Sync,
DhtEventStream: Sync,
Network: Send + Sync,
impl<Client, Network, Block, DhtEventStream> Unpin for Worker<Client, Network, Block, DhtEventStream> where
Block: Unpin,
DhtEventStream: Unpin,
impl<Client, Network, Block, DhtEventStream> !UnwindSafe for Worker<Client, Network, Block, DhtEventStream>
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
The counterpart to unchecked_from
.
Consume self to return an equivalent value of T
.
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more