Struct raftstore::store::fsm::apply::ApplyContext [−][src]
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: PriorityThe priority of this Handler.
yield_high_latency_operation: boolWhether to yield high-latency operation to low-priority handler.
Implementations
impl<EK, W> ApplyContext<EK, W> where
EK: KvEngine,
W: WriteBatch<EK>, [src]
EK: KvEngine,
W: WriteBatch<EK>,
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]
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>
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]
&mut self,
delegate: &mut ApplyDelegate<EK>,
results: VecDeque<ExecResult<EK::Snapshot>>
)
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,
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]
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,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<V, W> ConvertFrom<W> for V where
W: ConvertTo<V>, [src]
W: ConvertTo<V>,
pub fn convert_from(ctx: &mut EvalContext, from: W) -> Result<V, Error>[src]
impl<T> From<T> for T[src]
impl<T> Instrument for T[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>[src]
pub fn in_current_span(self) -> Instrumented<Self>[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Pointable for T[src]
pub const ALIGN: usize[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T[src]
pub unsafe fn drop(ptr: usize)[src]
impl<T> Pointable for T[src]
pub const ALIGN: usize[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T[src]
pub unsafe fn drop(ptr: usize)[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>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>, [src]
V: MultiLane<T>,