pub struct Dispatcher { /* private fields */ }Expand description
Fans record ops across N replica stores with round-robin + failover.
Implementations§
Source§impl Dispatcher
impl Dispatcher
Sourcepub fn new(replicas: Vec<Arc<dyn Store>>) -> Self
pub fn new(replicas: Vec<Arc<dyn Store>>) -> Self
Build a dispatcher over one or more replica stores.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of replica handles (live or not — deadness is discovered per op).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Always false; provided to satisfy clippy’s len-without-is_empty lint.
Sourcepub async fn get(&self, key: &RecordKey) -> Result<Option<Record>>
pub async fn get(&self, key: &RecordKey) -> Result<Option<Record>>
get with round-robin start + failover across all replicas.
Sourcepub async fn put(
&self,
record: Record,
expected: Option<Revision>,
) -> Result<PutResult>
pub async fn put( &self, record: Record, expected: Option<Revision>, ) -> Result<PutResult>
put with round-robin start + failover across all replicas. The record is
cloned per attempt so a failover can re-issue it to another replica. A
Conflict is a valid Ok outcome and returns immediately (not a failover).
Auto Trait Implementations§
impl !Freeze for Dispatcher
impl !RefUnwindSafe for Dispatcher
impl Send for Dispatcher
impl Sync for Dispatcher
impl Unpin for Dispatcher
impl UnsafeUnpin for Dispatcher
impl !UnwindSafe for Dispatcher
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
§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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request