pub struct NetworkServiceHandle<K: KeyType> {
pub local_peer_id: PeerId,
pub blueprint_protocol_name: Arc<str>,
pub local_signing_key: K::Secret,
pub sender: NetworkSender<K>,
pub receiver: NetworkReceiver,
pub peer_manager: Arc<PeerManager<K>>,
pub local_verification_key: Option<VerificationIdentifierKey<K>>,
}
Expand description
Combined handle for the network service
Fields§
§local_peer_id: PeerId
§blueprint_protocol_name: Arc<str>
§local_signing_key: K::Secret
§sender: NetworkSender<K>
§receiver: NetworkReceiver
§peer_manager: Arc<PeerManager<K>>
§local_verification_key: Option<VerificationIdentifierKey<K>>
The local verification key used to identify this node in the whitelist
Implementations§
Source§impl<K: KeyType> NetworkServiceHandle<K>
impl<K: KeyType> NetworkServiceHandle<K>
pub fn new( local_peer_id: PeerId, blueprint_protocol_name: String, local_signing_key: K::Secret, peer_manager: Arc<PeerManager<K>>, network_message_sender: Sender<NetworkCommandMessage<K>>, protocol_message_receiver: Receiver<ProtocolMessage>, ) -> Self
pub fn next_protocol_message(&mut self) -> Option<ProtocolMessage>
pub fn peers(&self) -> Vec<PeerId>
pub fn peer_info(&self, peer_id: &PeerId) -> Option<PeerInfo>
Sourcepub fn send(
&self,
routing: MessageRouting,
message: impl Into<Vec<u8>>,
) -> Result<(), String>
pub fn send( &self, routing: MessageRouting, message: impl Into<Vec<u8>>, ) -> Result<(), String>
Sourcepub fn send_network_message(
&self,
message: NetworkCommandMessage<K>,
) -> Result<(), String>
pub fn send_network_message( &self, message: NetworkCommandMessage<K>, ) -> Result<(), String>
pub fn get_listen_addr(&self) -> Option<Multiaddr>
Sourcepub fn get_participant_id(&self) -> Option<usize>
pub fn get_participant_id(&self) -> Option<usize>
Get the participant ID (index) of this node in the whitelisted keys
This returns the position of this node’s verification key in the whitelist, which can be used as a participant identifier.
§Returns
Returns the index in the whitelist if found, None otherwise
Sourcepub fn split(self) -> (NetworkSender<K>, NetworkReceiver)
pub fn split(self) -> (NetworkSender<K>, NetworkReceiver)
Split the handle into separate sender and receiver
Trait Implementations§
Auto Trait Implementations§
impl<K> Freeze for NetworkServiceHandle<K>
impl<K> !RefUnwindSafe for NetworkServiceHandle<K>
impl<K> Send for NetworkServiceHandle<K>
impl<K> Sync for NetworkServiceHandle<K>
impl<K> Unpin for NetworkServiceHandle<K>
impl<K> !UnwindSafe for NetworkServiceHandle<K>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more