Struct jormungandr::network::service::NodeService
source · pub struct NodeService {
channels: Channels,
global_state: GlobalStateR,
}
Fields§
§channels: Channels
§global_state: GlobalStateR
Implementations§
Trait Implementations§
source§impl BlockService for NodeService
impl BlockService for NodeService
§type PullBlocksStream = MapOk<ReplyStream<Block, Error>, fn(_: Block) -> <Block as Encode>::NetworkData>
type PullBlocksStream = MapOk<ReplyStream<Block, Error>, fn(_: Block) -> <Block as Encode>::NetworkData>
The type of an asynchronous stream that provides blocks in responce to
pull_blocks
method.§type PullBlocksToTipStream = MapOk<ReplyStream<Block, Error>, fn(_: Block) -> <Block as Encode>::NetworkData>
type PullBlocksToTipStream = MapOk<ReplyStream<Block, Error>, fn(_: Block) -> <Block as Encode>::NetworkData>
The type of an asynchronous stream that provides blocks in
response to
pull_blocks_to_tip
method.§type GetBlocksStream = MapOk<ReplyStream<Block, Error>, fn(_: Block) -> <Block as Encode>::NetworkData>
type GetBlocksStream = MapOk<ReplyStream<Block, Error>, fn(_: Block) -> <Block as Encode>::NetworkData>
The type of an asynchronous stream that provides blocks in
response to
get_blocks
method.§type PullHeadersStream = MapOk<ReplyStream<Header, Error>, fn(_: Header) -> <Header as Encode>::NetworkData>
type PullHeadersStream = MapOk<ReplyStream<Header, Error>, fn(_: Header) -> <Header as Encode>::NetworkData>
The type of an asynchronous stream that provides headers in
response to
pull_headers
method.§type GetHeadersStream = MapOk<ReplyStream<Header, Error>, fn(_: Header) -> <Header as Encode>::NetworkData>
type GetHeadersStream = MapOk<ReplyStream<Header, Error>, fn(_: Header) -> <Header as Encode>::NetworkData>
The type of an asynchronous stream that provides headers in
response to
get_headers
method.§type SubscriptionStream = Map<Select<Map<OutboundSubscription<Header>, fn(_: Header) -> BlockEvent>, Select<Map<OutboundSubscription<Box<[BlockId], Global>>, fn(_: Box<[BlockId], Global>) -> BlockEvent>, Map<OutboundSubscription<ChainPullRequest>, fn(_: ChainPullRequest) -> BlockEvent>>>, fn(_: <Select<Map<OutboundSubscription<Header>, fn(_: Header) -> BlockEvent>, Select<Map<OutboundSubscription<Box<[BlockId], Global>>, fn(_: Box<[BlockId], Global>) -> BlockEvent>, Map<OutboundSubscription<ChainPullRequest>, fn(_: ChainPullRequest) -> BlockEvent>>> as Stream>::Item) -> Result<<Select<Map<OutboundSubscription<Header>, fn(_: Header) -> BlockEvent>, Select<Map<OutboundSubscription<Box<[BlockId], Global>>, fn(_: Box<[BlockId], Global>) -> BlockEvent>, Map<OutboundSubscription<ChainPullRequest>, fn(_: ChainPullRequest) -> BlockEvent>>> as Stream>::Item, Error>>
type SubscriptionStream = Map<Select<Map<OutboundSubscription<Header>, fn(_: Header) -> BlockEvent>, Select<Map<OutboundSubscription<Box<[BlockId], Global>>, fn(_: Box<[BlockId], Global>) -> BlockEvent>, Map<OutboundSubscription<ChainPullRequest>, fn(_: ChainPullRequest) -> BlockEvent>>>, fn(_: <Select<Map<OutboundSubscription<Header>, fn(_: Header) -> BlockEvent>, Select<Map<OutboundSubscription<Box<[BlockId], Global>>, fn(_: Box<[BlockId], Global>) -> BlockEvent>, Map<OutboundSubscription<ChainPullRequest>, fn(_: ChainPullRequest) -> BlockEvent>>> as Stream>::Item) -> Result<<Select<Map<OutboundSubscription<Header>, fn(_: Header) -> BlockEvent>, Select<Map<OutboundSubscription<Box<[BlockId], Global>>, fn(_: Box<[BlockId], Global>) -> BlockEvent>, Map<OutboundSubscription<ChainPullRequest>, fn(_: ChainPullRequest) -> BlockEvent>>> as Stream>::Item, Error>>
The type of outbound asynchronous streams returned by the
subscription
method.source§fn tip<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Header, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn tip<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Header, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Serves a request for the current blockchain tip.
Resolves to the tip of the blockchain
accepted by this node.
source§fn pull_blocks<'life0, 'async_trait>(
&'life0 self,
from: BlockIds,
to: BlockId
) -> Pin<Box<dyn Future<Output = Result<Self::PullBlocksStream, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn pull_blocks<'life0, 'async_trait>( &'life0 self, from: BlockIds, to: BlockId ) -> Pin<Box<dyn Future<Output = Result<Self::PullBlocksStream, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Stream all blocks from the given range.
source§fn pull_blocks_to_tip<'life0, 'async_trait>(
&'life0 self,
from: BlockIds
) -> Pin<Box<dyn Future<Output = Result<Self::PullBlocksToTipStream, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn pull_blocks_to_tip<'life0, 'async_trait>( &'life0 self, from: BlockIds ) -> Pin<Box<dyn Future<Output = Result<Self::PullBlocksToTipStream, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Stream blocks from the first of the given starting points that is
found in the node’s chain, to the chain’s tip.
source§fn get_blocks<'life0, 'async_trait>(
&'life0 self,
ids: BlockIds
) -> Pin<Box<dyn Future<Output = Result<Self::GetBlocksStream, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_blocks<'life0, 'async_trait>( &'life0 self, ids: BlockIds ) -> Pin<Box<dyn Future<Output = Result<Self::GetBlocksStream, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Serves a request to retrieve blocks identified by the list of
ids
Resloves to a stream of blocks to send to the remote client peer.source§fn get_headers<'life0, 'async_trait>(
&'life0 self,
ids: BlockIds
) -> Pin<Box<dyn Future<Output = Result<Self::GetHeadersStream, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_headers<'life0, 'async_trait>( &'life0 self, ids: BlockIds ) -> Pin<Box<dyn Future<Output = Result<Self::GetHeadersStream, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Serves a request to retrieve block headers identified by the list of
ids
Resloves to a stream of headers to send to the remote client peer.source§fn pull_headers<'life0, 'async_trait>(
&'life0 self,
from: BlockIds,
to: BlockId
) -> Pin<Box<dyn Future<Output = Result<Self::PullHeadersStream, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn pull_headers<'life0, 'async_trait>( &'life0 self, from: BlockIds, to: BlockId ) -> Pin<Box<dyn Future<Output = Result<Self::PullHeadersStream, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Get blocks, walking forward in a range between either of the given
starting points, and the ending point.
source§fn push_headers<'life0, 'async_trait>(
&'life0 self,
stream: PushStream<Header>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn push_headers<'life0, 'async_trait>( &'life0 self, stream: PushStream<Header> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Called by the protocol implementation to handle a stream
of block headers sent by the peer in response to a
BlockEvent::Missing
solicitation.source§fn upload_blocks<'life0, 'async_trait>(
&'life0 self,
stream: PushStream<Block>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn upload_blocks<'life0, 'async_trait>( &'life0 self, stream: PushStream<Block> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Called by the protocol implementation to handle a stream
of blocks sent by the peer in response to a
BlockEvent::Solicit
solicitation.source§fn block_subscription<'life0, 'async_trait>(
&'life0 self,
subscriber: Peer,
stream: PushStream<Header>
) -> Pin<Box<dyn Future<Output = Result<Self::SubscriptionStream, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn block_subscription<'life0, 'async_trait>( &'life0 self, subscriber: Peer, stream: PushStream<Header> ) -> Pin<Box<dyn Future<Output = Result<Self::SubscriptionStream, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Called by the protocol implementation to establish a
bidirectional subscription stream.
The inbound stream is passed to the asynchronous method,
which resolves to the outbound stream.
source§impl Clone for NodeService
impl Clone for NodeService
source§fn clone(&self) -> NodeService
fn clone(&self) -> NodeService
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl FragmentService for NodeService
impl FragmentService for NodeService
§type GetFragmentsStream = MapOk<ReplyStream<Fragment, Error>, fn(_: Fragment) -> <Fragment as Encode>::NetworkData>
type GetFragmentsStream = MapOk<ReplyStream<Fragment, Error>, fn(_: Fragment) -> <Fragment as Encode>::NetworkData>
The type of an asynchronous stream that provides blocks in
response to
get_fragments
method.§type SubscriptionStream = Map<OutboundSubscription<Fragment>, fn(_: <OutboundSubscription<Fragment> as Stream>::Item) -> Result<<OutboundSubscription<Fragment> as Stream>::Item, Error>>
type SubscriptionStream = Map<OutboundSubscription<Fragment>, fn(_: <OutboundSubscription<Fragment> as Stream>::Item) -> Result<<OutboundSubscription<Fragment> as Stream>::Item, Error>>
The type of outbound asynchronous streams returned by the
subscription
method.source§fn get_fragments<'life0, 'async_trait>(
&'life0 self,
_ids: FragmentIds
) -> Pin<Box<dyn Future<Output = Result<Self::GetFragmentsStream, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_fragments<'life0, 'async_trait>( &'life0 self, _ids: FragmentIds ) -> Pin<Box<dyn Future<Output = Result<Self::GetFragmentsStream, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Serves a request to retrieve blocks identified by the list of
ids
Resloves to a stream of blocks to send to the remote client peer.source§fn fragment_subscription<'life0, 'async_trait>(
&'life0 self,
subscriber: Peer,
stream: PushStream<Fragment>
) -> Pin<Box<dyn Future<Output = Result<Self::SubscriptionStream, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn fragment_subscription<'life0, 'async_trait>( &'life0 self, subscriber: Peer, stream: PushStream<Fragment> ) -> Pin<Box<dyn Future<Output = Result<Self::SubscriptionStream, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Called by the protocol implementation to establish a
bidirectional subscription stream.
The inbound stream is passed to the asynchronous method,
which resolves to the outbound stream.
source§impl GossipService for NodeService
impl GossipService for NodeService
§type SubscriptionStream = Map<OutboundSubscription<Gossip>, fn(_: <OutboundSubscription<Gossip> as Stream>::Item) -> Result<<OutboundSubscription<Gossip> as Stream>::Item, Error>>
type SubscriptionStream = Map<OutboundSubscription<Gossip>, fn(_: <OutboundSubscription<Gossip> as Stream>::Item) -> Result<<OutboundSubscription<Gossip> as Stream>::Item, Error>>
The type of outbound asynchronous streams returned by the
subscription
method.source§fn gossip_subscription<'life0, 'async_trait>(
&'life0 self,
subscriber: Peer,
stream: PushStream<Gossip>
) -> Pin<Box<dyn Future<Output = Result<Self::SubscriptionStream, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn gossip_subscription<'life0, 'async_trait>( &'life0 self, subscriber: Peer, stream: PushStream<Gossip> ) -> Pin<Box<dyn Future<Output = Result<Self::SubscriptionStream, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Called by the protocol implementation to establish a
bidirectional subscription stream.
The inbound stream is passed to the asynchronous method,
which resolves to the outbound stream.
fn peers<'life0, 'async_trait>( &'life0 self, limit: u32 ) -> Pin<Box<dyn Future<Output = Result<Gossip, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
source§impl Node for NodeService
impl Node for NodeService
source§fn client_auth<'life0, 'async_trait>(
&'life0 self,
peer: Peer,
auth: AuthenticatedNodeId
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn client_auth<'life0, 'async_trait>( &'life0 self, peer: Peer, auth: AuthenticatedNodeId ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Handles client ID authentication.
§type BlockService = NodeService
type BlockService = NodeService
The implementation of the block service.
§type FragmentService = NodeService
type FragmentService = NodeService
The implementation of the fragment service.
§type GossipService = NodeService
type GossipService = NodeService
The implementation of the gossip service.
source§fn handshake<'life0, 'life1, 'async_trait>(
&'life0 self,
peer: Peer,
nonce: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<HandshakeResponse, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handshake<'life0, 'life1, 'async_trait>( &'life0 self, peer: Peer, nonce: &'life1 [u8] ) -> Pin<Box<dyn Future<Output = Result<HandshakeResponse, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Implements node handshake. The server returns the ID of the genesis
block and its own node ID, authenticated with the signature of
nonce
.source§fn block_service(&self) -> Option<&Self::BlockService>
fn block_service(&self) -> Option<&Self::BlockService>
Instantiates the block service,
if supported by this node.
source§fn fragment_service(&self) -> Option<&Self::FragmentService>
fn fragment_service(&self) -> Option<&Self::FragmentService>
Instantiates the fragment service,
if supported by this node.
source§fn gossip_service(&self) -> Option<&Self::GossipService>
fn gossip_service(&self) -> Option<&Self::GossipService>
Instantiates the gossip service,
if supported by this node.
Auto Trait Implementations§
impl !RefUnwindSafe for NodeService
impl Send for NodeService
impl Sync for NodeService
impl Unpin for NodeService
impl !UnwindSafe for NodeService
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request