pub struct ShuffleSender { /* private fields */ }Expand description
Lazy pool of outbound connections, keyed by peer id. Addresses go
in via register_peer (manual) or via the KV on first send.
Implementations§
Source§impl ShuffleSender
impl ShuffleSender
Sourcepub fn new(local_id: ShufflePeerId) -> Self
pub fn new(local_id: ShufflePeerId) -> Self
Empty sender. Peers must be added via register_peer or
discovered via the KV in with_kv before any send_to.
Sourcepub fn with_kv(local_id: ShufflePeerId, kv: Arc<dyn ClusterKv>) -> Self
pub fn with_kv(local_id: ShufflePeerId, kv: Arc<dyn ClusterKv>) -> Self
Construct a sender that falls back to kv when send_to is
called for a peer not previously registered. The KV is read
from the peer’s own state at SHUFFLE_ADDR_KEY.
Sourcepub async fn register_peer(&self, peer: ShufflePeerId, addr: SocketAddr)
pub async fn register_peer(&self, peer: ShufflePeerId, addr: SocketAddr)
Register (or update) a peer’s shuffle address. Must be called
before send_to(peer, ..).
Sourcepub async fn send_to(
&self,
peer: ShufflePeerId,
msg: &ShuffleMessage,
) -> Result<()>
pub async fn send_to( &self, peer: ShufflePeerId, msg: &ShuffleMessage, ) -> Result<()>
Send msg to peer, opening a connection if necessary.
§Errors
Returns io::Error on connect failure, peer-unregistered, or
frame write failure.
Sourcepub async fn fan_out_barrier(
&self,
peers: &[ShufflePeerId],
barrier: CheckpointBarrier,
) -> Result<()>
pub async fn fan_out_barrier( &self, peers: &[ShufflePeerId], barrier: CheckpointBarrier, ) -> Result<()>
Ship barrier to every peer in order. Short-circuits on the
first send failure; the gossip side-channel is the
authoritative announcement so a partial fan-out is tolerable.
§Errors
Returns the first io::Error from any peer’s send_to.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ShuffleSender
impl !RefUnwindSafe for ShuffleSender
impl Send for ShuffleSender
impl Sync for ShuffleSender
impl Unpin for ShuffleSender
impl UnsafeUnpin for ShuffleSender
impl !UnwindSafe for ShuffleSender
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
§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> 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 more