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 fn replicas(&self) -> &[Arc<dyn Store>]
pub fn replicas(&self) -> &[Arc<dyn Store>]
Every replica handle, in construction order. Used to read each replica directly (no round-robin, no failover) once the run has settled.
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).
Sourcepub async fn delete(
&self,
key: &RecordKey,
expected: Option<Revision>,
) -> Result<DeleteResult>
pub async fn delete( &self, key: &RecordKey, expected: Option<Revision>, ) -> Result<DeleteResult>
delete with round-robin start + failover across all replicas. A
Conflict is a valid Ok outcome and returns immediately (not a failover).
A failover after a delete that did commit on the dead replica is safe: the
retry sees a tombstone and returns Deleted without writing.
Auto Trait Implementations§
impl !Freeze for Dispatcher
impl !RefUnwindSafe for Dispatcher
impl !UnwindSafe for Dispatcher
impl Send for Dispatcher
impl Sync for Dispatcher
impl Unpin for Dispatcher
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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>
T in a tonic::Request