Struct cdc::CdcObserver[][src]

pub struct CdcObserver {
    sched: Scheduler<Task>,
    observe_regions: Arc<RwLock<HashMap<u64, ObserveID>>>,
    cmd_batches: RefCell<Vec<CmdBatch>>,
    last_batch_observing: RefCell<bool>,
}

An Observer for CDC.

It observes raftstore internal events, such as:

  1. Raft role change events,
  2. Apply command events.

Fields

sched: Scheduler<Task>observe_regions: Arc<RwLock<HashMap<u64, ObserveID>>>cmd_batches: RefCell<Vec<CmdBatch>>last_batch_observing: RefCell<bool>

Implementations

impl CdcObserver[src]

pub fn new(sched: Scheduler<Task>) -> CdcObserver[src]

Create a new CdcObserver.

Events are strong ordered, so sched must be implemented as a FIFO queue.

pub fn register_to(&self, coprocessor_host: &mut CoprocessorHost<RocksEngine>)[src]

pub fn subscribe_region(
    &self,
    region_id: u64,
    observe_id: ObserveID
) -> Option<ObserveID>
[src]

Subscribe an region, the observer will sink events of the region into its scheduler.

Return pervious ObserveID if there is one.

pub fn unsubscribe_region(
    &self,
    region_id: u64,
    observe_id: ObserveID
) -> Option<ObserveID>
[src]

Stops observe the region.

Return ObserverID if unsubscribe successfully.

pub fn is_subscribed(&self, region_id: u64) -> Option<ObserveID>[src]

Check whether the region is subscribed or not.

Trait Implementations

impl Clone for CdcObserver[src]

impl<E: KvEngine> CmdObserver<E> for CdcObserver[src]

impl Coprocessor for CdcObserver[src]

impl RegionChangeObserver for CdcObserver[src]

impl RoleObserver for CdcObserver[src]

Auto Trait Implementations

impl !RefUnwindSafe for CdcObserver

impl Send for CdcObserver

impl !Sync for CdcObserver

impl Unpin for CdcObserver

impl !UnwindSafe for CdcObserver

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<V, W> ConvertFrom<W> for V where
    W: ConvertTo<V>, 
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]