Struct cdc::delegate::Delegate[][src]

pub struct Delegate {
    pub handle: ObserveHandle,
    pub region_id: u64,
    region: Option<Region>,
    pub downstreams: Vec<Downstream>,
    pub resolver: Option<Resolver>,
    pending: Option<Pending>,
    failed: bool,
    pub txn_extra_op: TxnExtraOp,
}

A CDC delegate of a raftstore region peer.

It converts raft commands into CDC events and broadcast to downstreams. It also track trancation on the fly in order to compute resolved ts.

Fields

handle: ObserveHandleregion_id: u64region: Option<Region>downstreams: Vec<Downstream>resolver: Option<Resolver>pending: Option<Pending>failed: booltxn_extra_op: TxnExtraOp

Implementations

impl Delegate[src]

pub fn new(region_id: u64) -> Delegate[src]

Create a Delegate the given region.

pub fn subscribe(&mut self, downstream: Downstream) -> bool[src]

Return false if subscribe failed.

pub fn downstream(&self, downstream_id: DownstreamID) -> Option<&Downstream>[src]

pub fn downstreams(&self) -> &Vec<Downstream>[src]

pub fn downstreams_mut(&mut self) -> &mut Vec<Downstream>[src]

pub fn unsubscribe(&mut self, id: DownstreamID, err: Option<Error>) -> bool[src]

fn error_event(&self, err: Error) -> EventError[src]

pub fn mark_failed(&mut self)[src]

pub fn has_failed(&self) -> bool[src]

pub fn stop(&mut self, err: Error)[src]

Stop the delegate

This means the region has met an unrecoverable error for CDC. It broadcasts errors to all downstream and stops.

fn broadcast<F>(&self, send: F) -> Result<()> where
    F: Fn(&Downstream) -> Result<()>, 
[src]

pub fn on_region_ready(
    &mut self,
    resolver: Resolver,
    region: Region
) -> Vec<Downstream>
[src]

Install a resolver and return pending downstreams.

pub fn on_min_ts(&mut self, min_ts: TimeStamp) -> Option<TimeStamp>[src]

Try advance and broadcast resolved ts.

pub fn on_batch(
    &mut self,
    batch: CmdBatch,
    old_value_cb: &Box<dyn Fn(Key, TimeStamp, &mut OldValueCache) -> (Option<Vec<u8>>, Option<Statistics>) + Send>,
    old_value_cache: &mut OldValueCache
) -> Result<()>
[src]

pub(crate) fn convert_to_grpc_events(
    region_id: u64,
    request_id: u64,
    entries: Vec<Option<TxnEntry>>
) -> Vec<CdcEvent>
[src]

fn sink_data(
    &mut self,
    index: u64,
    requests: Vec<Request>,
    old_value_cb: &Box<dyn Fn(Key, TimeStamp, &mut OldValueCache) -> (Option<Vec<u8>>, Option<Statistics>) + Send>,
    old_value_cache: &mut OldValueCache,
    is_one_pc: bool
) -> Result<()>
[src]

fn sink_put(
    &mut self,
    put: PutRequest,
    is_one_pc: bool,
    rows: &mut HashMap<Vec<u8>, EventRow>,
    read_old_value: impl FnMut(&mut EventRow, TimeStamp)
)
[src]

fn sink_delete(&mut self, delete: DeleteRequest)[src]

fn sink_admin(
    &mut self,
    request: AdminRequest,
    response: AdminResponse
) -> Result<()>
[src]

Auto Trait Implementations

impl !RefUnwindSafe for Delegate

impl Send for Delegate

impl Sync for Delegate

impl Unpin for Delegate

impl !UnwindSafe for Delegate

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, 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]