Struct RemoteSyncPeer
pub struct RemoteSyncPeer<X> { /* private fields */ }Expand description
A SyncPeer whose far side is reached through an Exchange.
Its Resume is ADR-0097’s text ResumeToken, handed
back verbatim to the far side that minted it.
Implements the bare SyncPeer, so a !Send exchange is a valid
transport. Over a concrete Send exchange its futures are Send too, but
the type does not implement SendSyncPeer, and
coherence forbids adding it beside the bare impl: trait_variant’s
blanket impl already gives every SendSyncPeer the bare trait. Code that
spawns and binds SendSyncPeer takes
SendPeer::new(peer) instead, over a
SendExchange + Sync (#421).
Implementations§
§impl<X> RemoteSyncPeer<X>
impl<X> RemoteSyncPeer<X>
pub const fn new(exchange: X, limits: PeerLimits) -> Self
pub const fn new(exchange: X, limits: PeerLimits) -> Self
A peer over exchange, declaring the far side’s limits.
The limits are taken here because limits is not
async (SY-18): a runner reads them before a push, and cannot be made
to wait a round trip for them. The four wire messages do not carry them
(ADR-0097), so the transport brings them out of band: configuration
shared by both ends, or a request of its own at connect time, before
this is built — the far side’s are its
StoreSyncPeer’s
limits. This peer refuses a push over limits
before sending it, so declaring more than the far side accepts moves
the refusal from here, before the push, to the far side, after it;
declaring less only costs smaller batches.
pub fn into_exchange(self) -> X
pub fn into_exchange(self) -> X
The transport, handed back.
Trait Implementations§
§impl<X: Clone> Clone for RemoteSyncPeer<X>
impl<X: Clone> Clone for RemoteSyncPeer<X>
§impl<X: Debug> Debug for RemoteSyncPeer<X>
impl<X: Debug> Debug for RemoteSyncPeer<X>
§impl<X: Exchange> SyncPeer for RemoteSyncPeer<X>
impl<X: Exchange> SyncPeer for RemoteSyncPeer<X>
§async fn pull(
&self,
from: Option<&ResumeToken>,
) -> Result<Pulled<ResumeToken>, Self::Error>
async fn pull( &self, from: Option<&ResumeToken>, ) -> Result<Pulled<ResumeToken>, Self::Error>
One Route::Pull exchange.
§Errors
RemoteError::Exchange if the transport fails; RemoteError::Codec
if the reply is not a pulled message this build reads.
§async fn push(&self, batch: &PushBatch) -> Result<Ack, Self::Error>
async fn push(&self, batch: &PushBatch) -> Result<Ack, Self::Error>
One Route::Push exchange, or none when the declared limits refuse
the batch.
§Errors
RemoteError::EventTooLarge, TooManyEvents
or BatchTooLarge for a push the declared
limits do not admit, checked in that order and before anything is sent;
RemoteError::Exchange if the transport fails, including a refusal
the far side reported through it; RemoteError::Codec if the reply
is not an ack this build reads.