pub struct NodeService {
    channels: Channels,
    global_state: GlobalStateR,
}

Fields§

§channels: Channels§global_state: GlobalStateR

Implementations§

source§

impl NodeService

source

pub fn new(channels: Channels, global_state: GlobalStateR) -> Self

source

async fn peer_id(&self, addr: Address) -> Result<NodeId, Error>

Trait Implementations§

source§

impl BlockService for NodeService

§

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>

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>

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>

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>

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>>

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,

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,

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,

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,

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,

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,

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,

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,

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,

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

source§

fn clone(&self) -> NodeService

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl FragmentService for NodeService

§

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>>

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,

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,

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

§

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,

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§

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

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,

Handles client ID authentication.

§

type BlockService = NodeService

The implementation of the block service.
§

type FragmentService = NodeService

The implementation of the fragment service.
§

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,

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>

Instantiates the block service, if supported by this node.
source§

fn fragment_service(&self) -> Option<&Self::FragmentService>

Instantiates the fragment service, if supported by this node.
source§

fn gossip_service(&self) -> Option<&Self::GossipService>

Instantiates the gossip service, if supported by this node.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for Twhere T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more