pub trait EventListener: Send + Sync {
fn on_flush_begin(&self, _: &FlushJobInfo) { ... }
fn on_flush_completed(&self, _: &FlushJobInfo) { ... }
fn on_compaction_begin(&self, _: &CompactionJobInfo) { ... }
fn on_compaction_completed(&self, _: &CompactionJobInfo) { ... }
fn on_subcompaction_begin(&self, _: &SubcompactionJobInfo) { ... }
fn on_subcompaction_completed(&self, _: &SubcompactionJobInfo) { ... }
fn on_external_file_ingested(&self, _: &IngestionInfo) { ... }
fn on_background_error(
&self,
_: DBBackgroundErrorReason,
_: Result<(), String>
) { ... }
fn on_stall_conditions_changed(&self, _: &WriteStallInfo) { ... }
}
EventListener trait contains a set of call-back functions that will
be called when specific RocksDB event happens such as flush. It can
be used as a building block for developing custom features such as
stats-collector or external compaction algorithm.
Note that call-back functions should not run for an extended period of
time before the function returns, otherwise RocksDB may be blocked.
For more information, please see
doc of rocksdb.