public abstract class AbstractEventListener extends RocksCallbackObject implements EventListener
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractEventListener.EnabledEventCallback |
nativeHandle_owningHandle_| Modifier | Constructor and Description |
|---|---|
protected |
AbstractEventListener()
Creates an Event Listener that will
receive all callbacks from C++.
|
protected |
AbstractEventListener(AbstractEventListener.EnabledEventCallback... enabledEventCallbacks)
Creates an Event Listener that will
receive only certain callbacks from C++.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
disposeInternal()
Deletes underlying C++ native callback object pointer
|
protected long |
initializeNative(long... nativeParameterHandles)
Construct the Native C++ object which will callback
to our object methods
|
void |
onBackgroundError(BackgroundErrorReason backgroundErrorReason,
Status backgroundError)
A callback function for RocksDB which will be called before setting the
background error status to a non-OK value.
|
void |
onColumnFamilyHandleDeletionStarted(ColumnFamilyHandle columnFamilyHandle)
A callback function for RocksDB which will be called before
a column family handle is deleted.
|
void |
onCompactionBegin(RocksDB db,
CompactionJobInfo compactionJobInfo)
A callback function to RocksDB which will be called before a
RocksDB starts to compact.
|
void |
onCompactionCompleted(RocksDB db,
CompactionJobInfo compactionJobInfo)
A callback function for RocksDB which will be called whenever
a registered RocksDB compacts a file.
|
boolean |
onErrorRecoveryBegin(BackgroundErrorReason backgroundErrorReason,
Status backgroundError)
A callback function for RocksDB which will be called just before
starting the automatic recovery process for recoverable background
errors, such as NoSpace().
|
void |
onErrorRecoveryCompleted(Status oldBackgroundError)
A callback function for RocksDB which will be called once the database
is recovered from read-only mode after an error.
|
void |
onExternalFileIngested(RocksDB db,
ExternalFileIngestionInfo externalFileIngestionInfo)
A callback function for RocksDB which will be called after an external
file is ingested using IngestExternalFile.
|
void |
onFileCloseFinish(FileOperationInfo fileOperationInfo)
A callback function for RocksDB which will be called whenever a file close
operation finishes.
|
void |
onFileFlushFinish(FileOperationInfo fileOperationInfo)
A callback function for RocksDB which will be called whenever a file flush
operation finishes.
|
void |
onFileRangeSyncFinish(FileOperationInfo fileOperationInfo)
A callback function for RocksDB which will be called whenever a file
rangeSync operation finishes.
|
void |
onFileReadFinish(FileOperationInfo fileOperationInfo)
A callback function for RocksDB which will be called whenever a file read
operation finishes.
|
void |
onFileSyncFinish(FileOperationInfo fileOperationInfo)
A callback function for RocksDB which will be called whenever a file sync
operation finishes.
|
void |
onFileTruncateFinish(FileOperationInfo fileOperationInfo)
A callback function for RocksDB which will be called whenever a file
truncate operation finishes.
|
void |
onFileWriteFinish(FileOperationInfo fileOperationInfo)
A callback function for RocksDB which will be called whenever a file write
operation finishes.
|
void |
onFlushBegin(RocksDB db,
FlushJobInfo flushJobInfo)
A callback function to RocksDB which will be called before a
RocksDB starts to flush memtables.
|
void |
onFlushCompleted(RocksDB db,
FlushJobInfo flushJobInfo)
callback function to RocksDB which will be called whenever a
registered RocksDB flushes a file.
|
void |
onMemTableSealed(MemTableInfo memTableInfo)
A callback function for RocksDB which will be called before
a memtable is made immutable.
|
void |
onStallConditionsChanged(WriteStallInfo writeStallInfo)
A callback function for RocksDB which will be called whenever a change
of superversion triggers a change of the stall conditions.
|
void |
onTableFileCreated(TableFileCreationInfo tableFileCreationInfo)
A callback function for RocksDB which will be called whenever
a SST file is created.
|
void |
onTableFileCreationStarted(TableFileCreationBriefInfo tableFileCreationBriefInfo)
A callback function for RocksDB which will be called before
a SST file is being created.
|
void |
onTableFileDeleted(TableFileDeletionInfo tableFileDeletionInfo)
A callback function for RocksDB which will be called whenever
a SST file is deleted.
|
boolean |
shouldBeNotifiedOnFileIO()
If true, the
EventListener.onFileReadFinish(FileOperationInfo)
and EventListener.onFileWriteFinish(FileOperationInfo) will be called. |
close, disOwnNativeHandle, isOwningHandleprotected AbstractEventListener()
If you don't need all callbacks, it is much more efficient to
just register for the ones you need by calling
AbstractEventListener(EnabledEventCallback...) instead.
protected AbstractEventListener(AbstractEventListener.EnabledEventCallback... enabledEventCallbacks)
enabledEventCallbacks - callbacks to enable in Java.public void onFlushCompleted(RocksDB db, FlushJobInfo flushJobInfo)
EventListenerNote that the this function must be implemented in a way such that it should not run for an extended period of time before the function returns. Otherwise, RocksDB may be blocked.
onFlushCompleted in interface EventListenerdb - the databaseflushJobInfo - the flush job info, contains data copied from
respective native structure.public void onFlushBegin(RocksDB db, FlushJobInfo flushJobInfo)
EventListenerNote that the this function must be implemented in a way such that it should not run for an extended period of time before the function returns. Otherwise, RocksDB may be blocked.
onFlushBegin in interface EventListenerdb - the databaseflushJobInfo - the flush job info, contains data copied from
respective native structure.public void onTableFileDeleted(TableFileDeletionInfo tableFileDeletionInfo)
EventListenerEventListener.onCompactionCompleted(RocksDB, CompactionJobInfo) and
EventListener.onFlushCompleted(RocksDB, FlushJobInfo),
this callback is designed for external logging
service and thus only provide string parameters instead
of a pointer to DB. Applications that build logic basic based
on file creations and deletions is suggested to implement
EventListener.onFlushCompleted(RocksDB, FlushJobInfo) and
EventListener.onCompactionCompleted(RocksDB, CompactionJobInfo).
Note that if applications would like to use the passed reference outside this function call, they should make copies from the returned value.
onTableFileDeleted in interface EventListenertableFileDeletionInfo - the table file deletion info,
contains data copied from respective native structure.public void onCompactionBegin(RocksDB db, CompactionJobInfo compactionJobInfo)
EventListenerNote that the this function must be implemented in a way such that it should not run for an extended period of time before the function returns. Otherwise, RocksDB may be blocked.
onCompactionBegin in interface EventListenerdb - a pointer to the rocksdb instance which just compacted
a file.compactionJobInfo - a reference to a native CompactionJobInfo struct,
which is released after this function is returned, and must be copied
if it is needed outside of this function.public void onCompactionCompleted(RocksDB db, CompactionJobInfo compactionJobInfo)
EventListenerNote that this function must be implemented in a way such that it should not run for an extended period of time before the function returns. Otherwise, RocksDB may be blocked.
onCompactionCompleted in interface EventListenerdb - a pointer to the rocksdb instance which just compacted
a file.compactionJobInfo - a reference to a native CompactionJobInfo struct,
which is released after this function is returned, and must be copied
if it is needed outside of this function.public void onTableFileCreated(TableFileCreationInfo tableFileCreationInfo)
EventListenerHistorically it will only be called if the file is successfully created. Now it will also be called on failure case. User can check info.status to see if it succeeded or not.
Note that if applications would like to use the passed reference outside this function call, they should make copies from these returned value.
onTableFileCreated in interface EventListenertableFileCreationInfo - the table file creation info,
contains data copied from respective native structure.public void onTableFileCreationStarted(TableFileCreationBriefInfo tableFileCreationBriefInfo)
EventListenerNote that if applications would like to use the passed reference outside this function call, they should make copies from these returned value.
onTableFileCreationStarted in interface EventListenertableFileCreationBriefInfo - the table file creation brief info,
contains data copied from respective native structure.public void onMemTableSealed(MemTableInfo memTableInfo)
EventListenerNote that the this function must be implemented in a way such that it should not run for an extended period of time before the function returns. Otherwise, RocksDB may be blocked.
Note that if applications would like to use the passed reference outside this function call, they should make copies from these returned value.
onMemTableSealed in interface EventListenermemTableInfo - the mem table info, contains data
copied from respective native structure.public void onColumnFamilyHandleDeletionStarted(ColumnFamilyHandle columnFamilyHandle)
EventListenerNote that the this function must be implemented in a way such that it should not run for an extended period of time before the function returns. Otherwise, RocksDB may be blocked.
onColumnFamilyHandleDeletionStarted in interface EventListenercolumnFamilyHandle - is a pointer to the column family handle to be
deleted which will become a dangling pointer after the deletion.public void onExternalFileIngested(RocksDB db, ExternalFileIngestionInfo externalFileIngestionInfo)
EventListenerNote that the this function will run on the same thread as IngestExternalFile(), if this function is blocked, IngestExternalFile() will be blocked from finishing.
onExternalFileIngested in interface EventListenerdb - the databaseexternalFileIngestionInfo - the external file ingestion info,
contains data copied from respective native structure.public void onBackgroundError(BackgroundErrorReason backgroundErrorReason, Status backgroundError)
EventListenerNote that this function can run on the same threads as flush, compaction, and user writes. So, it is extremely important not to perform heavy computations or blocking calls in this function.
onBackgroundError in interface EventListenerbackgroundErrorReason - background error reason codebackgroundError - background error codespublic void onStallConditionsChanged(WriteStallInfo writeStallInfo)
EventListenerNote that the this function must be implemented in a way such that it should not run for an extended period of time before the function returns. Otherwise, RocksDB may be blocked.
onStallConditionsChanged in interface EventListenerwriteStallInfo - write stall info,
contains data copied from respective native structure.public void onFileReadFinish(FileOperationInfo fileOperationInfo)
EventListeneronFileReadFinish in interface EventListenerfileOperationInfo - file operation info,
contains data copied from respective native structure.public void onFileWriteFinish(FileOperationInfo fileOperationInfo)
EventListeneronFileWriteFinish in interface EventListenerfileOperationInfo - file operation info,
contains data copied from respective native structure.public void onFileFlushFinish(FileOperationInfo fileOperationInfo)
EventListeneronFileFlushFinish in interface EventListenerfileOperationInfo - file operation info,
contains data copied from respective native structure.public void onFileSyncFinish(FileOperationInfo fileOperationInfo)
EventListeneronFileSyncFinish in interface EventListenerfileOperationInfo - file operation info,
contains data copied from respective native structure.public void onFileRangeSyncFinish(FileOperationInfo fileOperationInfo)
EventListeneronFileRangeSyncFinish in interface EventListenerfileOperationInfo - file operation info,
contains data copied from respective native structure.public void onFileTruncateFinish(FileOperationInfo fileOperationInfo)
EventListeneronFileTruncateFinish in interface EventListenerfileOperationInfo - file operation info,
contains data copied from respective native structure.public void onFileCloseFinish(FileOperationInfo fileOperationInfo)
EventListeneronFileCloseFinish in interface EventListenerfileOperationInfo - file operation info,
contains data copied from respective native structure.public boolean shouldBeNotifiedOnFileIO()
EventListenerEventListener.onFileReadFinish(FileOperationInfo)
and EventListener.onFileWriteFinish(FileOperationInfo) will be called. If
false, then they won't be called.
Default: false
shouldBeNotifiedOnFileIO in interface EventListenerpublic boolean onErrorRecoveryBegin(BackgroundErrorReason backgroundErrorReason, Status backgroundError)
EventListeneronErrorRecoveryBegin in interface EventListenerbackgroundErrorReason - background error reason codebackgroundError - background error codesfalse if the automatic recovery should be suppressedpublic void onErrorRecoveryCompleted(Status oldBackgroundError)
EventListeneronErrorRecoveryCompleted in interface EventListeneroldBackgroundError - old background error codesprotected long initializeNative(long... nativeParameterHandles)
RocksCallbackObjectinitializeNative in class RocksCallbackObjectnativeParameterHandles - An array of native handles for any parameter
objects that are needed during constructionprotected void disposeInternal()
disposeInternal in class RocksCallbackObject