Struct raftstore::store::fsm::apply::ApplyContext[][src]

struct ApplyContext<EK, W> where
    EK: KvEngine,
    W: WriteBatch<EK>, 
{ tag: String, timer: Option<Instant>, host: CoprocessorHost<EK>, importer: Arc<SSTImporter>, region_scheduler: Scheduler<RegionTask<EK::Snapshot>>, router: ApplyRouter<EK>, notifier: Box<dyn Notifier<EK>>, engine: EK, cbs: MustConsumeVec<ApplyCallback<EK>>, apply_res: Vec<ApplyRes<EK::Snapshot>>, exec_ctx: Option<ExecContext>, kv_wb: W, kv_wb_last_bytes: u64, kv_wb_last_keys: u64, last_applied_index: u64, committed_count: usize, sync_log_hint: bool, use_delete_range: bool, perf_context: EK::PerfContext, yield_duration: Duration, store_id: u64, pending_create_peers: Arc<Mutex<HashMap<u64, (u64, bool)>>>, delete_ssts: Vec<SSTMetaInfo>, priority: Priority, yield_high_latency_operation: bool, }

Fields

tag: Stringtimer: Option<Instant>host: CoprocessorHost<EK>importer: Arc<SSTImporter>region_scheduler: Scheduler<RegionTask<EK::Snapshot>>router: ApplyRouter<EK>notifier: Box<dyn Notifier<EK>>engine: EKcbs: MustConsumeVec<ApplyCallback<EK>>apply_res: Vec<ApplyRes<EK::Snapshot>>exec_ctx: Option<ExecContext>kv_wb: Wkv_wb_last_bytes: u64kv_wb_last_keys: u64last_applied_index: u64committed_count: usizesync_log_hint: booluse_delete_range: boolperf_context: EK::PerfContextyield_duration: Durationstore_id: u64pending_create_peers: Arc<Mutex<HashMap<u64, (u64, bool)>>>

region_id -> (peer_id, is_splitting) Used for handling race between splitting and creating new peer. An uninitialized peer can be replaced to the one from splitting iff they are exactly the same peer.

delete_ssts: Vec<SSTMetaInfo>

We must delete the ingested file before calling callback so that any ingest-request reaching this peer could see this update if leader had changed. We must also delete them after the applied-index has been persisted to kvdb because this entry may replay because of panic or power-off, which happened before WriteBatch::write and after SSTImporter::delete. We shall make sure that this entry will never apply again at first, then we can delete the ssts files.

priority: Priority

The priority of this Handler.

yield_high_latency_operation: bool

Whether to yield high-latency operation to low-priority handler.

Implementations

impl<EK, W> ApplyContext<EK, W> where
    EK: KvEngine,
    W: WriteBatch<EK>, 
[src]

pub fn new(
    tag: String,
    host: CoprocessorHost<EK>,
    importer: Arc<SSTImporter>,
    region_scheduler: Scheduler<RegionTask<EK::Snapshot>>,
    engine: EK,
    router: ApplyRouter<EK>,
    notifier: Box<dyn Notifier<EK>>,
    cfg: &Config,
    store_id: u64,
    pending_create_peers: Arc<Mutex<HashMap<u64, (u64, bool)>>>,
    priority: Priority
) -> ApplyContext<EK, W>
[src]

pub fn prepare_for(&mut self, delegate: &mut ApplyDelegate<EK>)[src]

Prepares for applying entries for delegate.

A general apply progress for a delegate is: prepare_for -> commit [-> commit …] -> finish_for. After all delegates are handled, write_to_db method should be called.

pub fn commit(&mut self, delegate: &mut ApplyDelegate<EK>)[src]

Commits all changes have done for delegate. persistent indicates whether write the changes into rocksdb.

This call is valid only when it’s between a prepare_for and finish_for.

fn commit_opt(&mut self, delegate: &mut ApplyDelegate<EK>, persistent: bool)[src]

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

Writes all the changes into RocksDB. If it returns true, all pending writes are persisted in engines.

pub fn finish_for(
    &mut self,
    delegate: &mut ApplyDelegate<EK>,
    results: VecDeque<ExecResult<EK::Snapshot>>
)
[src]

Finishes Applys for the delegate.

pub fn delta_bytes(&self) -> u64[src]

pub fn delta_keys(&self) -> u64[src]

pub fn kv_wb(&self) -> &W[src]

pub fn kv_wb_mut(&mut self) -> &mut W[src]

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

Flush all pending writes to engines. If it returns true, all pending writes are persisted in engines.

Auto Trait Implementations

impl<EK, W> !RefUnwindSafe for ApplyContext<EK, W>

impl<EK, W> Send for ApplyContext<EK, W>

impl<EK, W> !Sync for ApplyContext<EK, W>

impl<EK, W> Unpin for ApplyContext<EK, W> where
    W: Unpin,
    <EK as PerfContextExt>::PerfContext: Unpin,
    <EK as KvEngine>::Snapshot: Unpin

impl<EK, W> !UnwindSafe for ApplyContext<EK, W>

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]