Struct cdc::delegate::Delegate [−][src]
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: ObserveHandle
region_id: u64
region: Option<Region>
downstreams: Vec<Downstream>
resolver: Option<Resolver>
pending: Option<Pending>
failed: bool
txn_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]
F: Fn(&Downstream) -> Result<()>,
pub fn on_region_ready(
&mut self,
resolver: Resolver,
region: Region
) -> Vec<Downstream>
[src][−]
&mut self,
resolver: Resolver,
region: Region
) -> Vec<Downstream>
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]
&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<()>
pub(crate) fn convert_to_grpc_events(
region_id: u64,
request_id: u64,
entries: Vec<Option<TxnEntry>>
) -> Vec<CdcEvent>
[src]
region_id: u64,
request_id: u64,
entries: Vec<Option<TxnEntry>>
) -> Vec<CdcEvent>
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]
&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<()>
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]
&mut self,
put: PutRequest,
is_one_pc: bool,
rows: &mut HashMap<Vec<u8>, EventRow>,
read_old_value: impl FnMut(&mut EventRow, TimeStamp)
)
fn sink_delete(&mut self, delete: DeleteRequest)
[src]
fn sink_admin(
&mut self,
request: AdminRequest,
response: AdminResponse
) -> Result<()>
[src]
&mut self,
request: AdminRequest,
response: AdminResponse
) -> Result<()>
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][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<V, W> ConvertFrom<W> for V where
W: ConvertTo<V>,
[src][+]
W: ConvertTo<V>,
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][+]
U: From<T>,
impl<T> Pointable for T
[src][+]
impl<T> Pointable for T
[src][+]
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> Sealed<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src][+]
V: MultiLane<T>,