pub trait EventListener: Sync + Send {
// Provided methods
fn post_new_log_file(&self, _file_id: FileId) { ... }
fn on_append_log_file(&self, _handle: FileBlockHandle) { ... }
fn post_apply_memtables(&self, _file_id: FileId) { ... }
fn first_file_not_ready_for_purge(
&self,
_queue: LogQueue,
) -> Option<FileSeq> { ... }
fn post_purge(&self, _file_id: FileId) { ... }
}
Expand description
EventListener
contains a set of callback functions that will be notified
on specific events inside Raft Engine.
§Threading
Different callbacks are called under different threading contexts.
on_append_log_file
, for example, will be called under a global lock of
one specific queue.
Provided Methods§
Sourcefn post_new_log_file(&self, _file_id: FileId)
fn post_new_log_file(&self, _file_id: FileId)
Called after a new log file is created.
Sourcefn on_append_log_file(&self, _handle: FileBlockHandle)
fn on_append_log_file(&self, _handle: FileBlockHandle)
Called before a LogBatch
has been written into a log file.
Sourcefn post_apply_memtables(&self, _file_id: FileId)
fn post_apply_memtables(&self, _file_id: FileId)
Sourcefn first_file_not_ready_for_purge(&self, _queue: LogQueue) -> Option<FileSeq>
fn first_file_not_ready_for_purge(&self, _queue: LogQueue) -> Option<FileSeq>
Returns the oldest file sequence number that are not ready to be purged.
Sourcefn post_purge(&self, _file_id: FileId)
fn post_purge(&self, _file_id: FileId)
Called after a log file is purged.