pub struct NotificationsSink { /* private fields */ }
Expand description
Sink connected directly to the node background task. Allows sending notifications to the peer.
Can be cloned in order to obtain multiple references to the substream of the same peer.
Implementations§
Source§impl NotificationsSink
impl NotificationsSink
Sourcepub fn new(
peer_id: PeerId,
) -> (Self, Receiver<NotificationsSinkMessage>, Receiver<NotificationsSinkMessage>)
pub fn new( peer_id: PeerId, ) -> (Self, Receiver<NotificationsSinkMessage>, Receiver<NotificationsSinkMessage>)
Create new NotificationsSink
.
NOTE: only used for testing but must be pub
as other crates in client/network
use this.
Sourcepub fn metrics(&self) -> &Option<Arc<NotificationMetrics>>
pub fn metrics(&self) -> &Option<Arc<NotificationMetrics>>
Get reference to metrics.
Source§impl NotificationsSink
impl NotificationsSink
Sourcepub fn send_sync_notification(&self, message: impl Into<Vec<u8>>)
pub fn send_sync_notification(&self, message: impl Into<Vec<u8>>)
Sends a notification to the peer.
If too many messages are already buffered, the notification is silently discarded and the connection to the peer will be closed shortly after.
The protocol name is expected to be checked ahead of calling this method. It is a logic error to send a notification using an unknown protocol.
This method will be removed in a future version.
Sourcepub async fn reserve_notification(&self) -> Result<Ready<'_>, ()>
pub async fn reserve_notification(&self) -> Result<Ready<'_>, ()>
Wait until the remote is ready to accept a notification.
Returns an error in the case where the connection is closed.
The protocol name is expected to be checked ahead of calling this method. It is a logic error to send a notification using an unknown protocol.
Trait Implementations§
Source§impl Clone for NotificationsSink
impl Clone for NotificationsSink
Source§fn clone(&self) -> NotificationsSink
fn clone(&self) -> NotificationsSink
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for NotificationsSink
impl !RefUnwindSafe for NotificationsSink
impl Send for NotificationsSink
impl Sync for NotificationsSink
impl Unpin for NotificationsSink
impl !UnwindSafe for NotificationsSink
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
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>
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>
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 moreSource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read moreSource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.