pub struct RemoteClient { /* private fields */ }Expand description
A remote client that talks to a crafty cluster over any Transport
(live QUIC/HTTP/3 in production, the in-memory LocalNetwork in tests).
A client may contact any node: a follower transparently forwards to the
leader server-side (client-routing), so a single reachable node is enough. The
client is nonetheless configured with several targets and a
RetryPolicy so it survives a node being down or an election in flight —
it rotates across targets, and follows a NotLeader hint straight to the
named leader when one is returned.
Implementations§
Source§impl RemoteClient
impl RemoteClient
Sourcepub fn new(
transport: Arc<dyn Transport>,
targets: impl IntoIterator<Item = NodeId>,
) -> Self
pub fn new( transport: Arc<dyn Transport>, targets: impl IntoIterator<Item = NodeId>, ) -> Self
Build a client over transport that contacts targets (seed node ids;
the transport resolves each to an address). Uses the default
RetryPolicy.
Sourcepub fn with_retry(self, retry: RetryPolicy) -> Self
pub fn with_retry(self, retry: RetryPolicy) -> Self
Override the RetryPolicy.
Trait Implementations§
Source§impl Client for RemoteClient
impl Client for RemoteClient
Source§impl KeyedClient for RemoteClient
impl KeyedClient for RemoteClient
Source§impl TwoPhaseClient for RemoteClient
impl TwoPhaseClient for RemoteClient
Source§fn prepare_keyed(
&self,
tx_id: Vec<u8>,
key: Vec<u8>,
command: Vec<u8>,
) -> impl Future<Output = Result<Vec<u8>, ClientError>> + Send
fn prepare_keyed( &self, tx_id: Vec<u8>, key: Vec<u8>, command: Vec<u8>, ) -> impl Future<Output = Result<Vec<u8>, ClientError>> + Send
Stage a command on the shard for
key under tx_id.Auto Trait Implementations§
impl !Freeze for RemoteClient
impl !RefUnwindSafe for RemoteClient
impl !UnwindSafe for RemoteClient
impl Send for RemoteClient
impl Sync for RemoteClient
impl Unpin for RemoteClient
impl UnsafeUnpin for RemoteClient
Blanket Implementations§
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