Skip to main content

Shardable

Trait Shardable 

Source
pub trait Shardable {
    type Shard: Debug + Clone + Send + Sync;

    // Required methods
    fn shards(
        &self,
        pd_client: &Arc<impl PdClient>,
    ) -> BoxStream<'static, Result<(Self::Shard, RegionWithLeader)>>;
    fn apply_shard(&mut self, shard: Self::Shard);
    fn apply_store(&mut self, store: &RegionStore) -> Result<()>;

    // Provided method
    fn clone_then_apply_shard(&self, shard: Self::Shard) -> Self
       where Self: Sized + Clone { ... }
}

Required Associated Types§

Required Methods§

Source

fn shards( &self, pd_client: &Arc<impl PdClient>, ) -> BoxStream<'static, Result<(Self::Shard, RegionWithLeader)>>

Source

fn apply_shard(&mut self, shard: Self::Shard)

Source

fn apply_store(&mut self, store: &RegionStore) -> Result<()>

Provided Methods§

Source

fn clone_then_apply_shard(&self, shard: Self::Shard) -> Self
where Self: Sized + Clone,

Implementation can skip unnecessary fields clone if fields will be overwritten by apply_shard.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<P: Plan + Shardable> Shardable for PreserveShard<P>

Source§

impl<P: Plan + Shardable, PdC: PdClient> Shardable for CleanupLocks<P, PdC>

Source§

impl<P: Plan + Shardable, PdC: PdClient> Shardable for ResolveLock<P, PdC>

Source§

impl<Req: KvRequest + Shardable> Shardable for Dispatch<Req>

Source§

type Shard = <Req as Shardable>::Shard