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, isOwningHandle
protected 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)
EventListener
Note 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 EventListener
db
- the databaseflushJobInfo
- the flush job info, contains data copied from
respective native structure.public void onFlushBegin(RocksDB db, FlushJobInfo flushJobInfo)
EventListener
Note 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 EventListener
db
- the databaseflushJobInfo
- the flush job info, contains data copied from
respective native structure.public void onTableFileDeleted(TableFileDeletionInfo tableFileDeletionInfo)
EventListener
EventListener.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 EventListener
tableFileDeletionInfo
- the table file deletion info,
contains data copied from respective native structure.public void onCompactionBegin(RocksDB db, CompactionJobInfo compactionJobInfo)
EventListener
Note 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 EventListener
db
- 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)
EventListener
Note 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 EventListener
db
- 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)
EventListener
Historically 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 EventListener
tableFileCreationInfo
- the table file creation info,
contains data copied from respective native structure.public void onTableFileCreationStarted(TableFileCreationBriefInfo tableFileCreationBriefInfo)
EventListener
Note 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 EventListener
tableFileCreationBriefInfo
- the table file creation brief info,
contains data copied from respective native structure.public void onMemTableSealed(MemTableInfo memTableInfo)
EventListener
Note 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 EventListener
memTableInfo
- the mem table info, contains data
copied from respective native structure.public void onColumnFamilyHandleDeletionStarted(ColumnFamilyHandle columnFamilyHandle)
EventListener
Note 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 EventListener
columnFamilyHandle
- 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)
EventListener
Note 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 EventListener
db
- the databaseexternalFileIngestionInfo
- the external file ingestion info,
contains data copied from respective native structure.public void onBackgroundError(BackgroundErrorReason backgroundErrorReason, Status backgroundError)
EventListener
Note 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 EventListener
backgroundErrorReason
- background error reason codebackgroundError
- background error codespublic void onStallConditionsChanged(WriteStallInfo writeStallInfo)
EventListener
Note 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 EventListener
writeStallInfo
- write stall info,
contains data copied from respective native structure.public void onFileReadFinish(FileOperationInfo fileOperationInfo)
EventListener
onFileReadFinish
in interface EventListener
fileOperationInfo
- file operation info,
contains data copied from respective native structure.public void onFileWriteFinish(FileOperationInfo fileOperationInfo)
EventListener
onFileWriteFinish
in interface EventListener
fileOperationInfo
- file operation info,
contains data copied from respective native structure.public void onFileFlushFinish(FileOperationInfo fileOperationInfo)
EventListener
onFileFlushFinish
in interface EventListener
fileOperationInfo
- file operation info,
contains data copied from respective native structure.public void onFileSyncFinish(FileOperationInfo fileOperationInfo)
EventListener
onFileSyncFinish
in interface EventListener
fileOperationInfo
- file operation info,
contains data copied from respective native structure.public void onFileRangeSyncFinish(FileOperationInfo fileOperationInfo)
EventListener
onFileRangeSyncFinish
in interface EventListener
fileOperationInfo
- file operation info,
contains data copied from respective native structure.public void onFileTruncateFinish(FileOperationInfo fileOperationInfo)
EventListener
onFileTruncateFinish
in interface EventListener
fileOperationInfo
- file operation info,
contains data copied from respective native structure.public void onFileCloseFinish(FileOperationInfo fileOperationInfo)
EventListener
onFileCloseFinish
in interface EventListener
fileOperationInfo
- file operation info,
contains data copied from respective native structure.public boolean shouldBeNotifiedOnFileIO()
EventListener
EventListener.onFileReadFinish(FileOperationInfo)
and EventListener.onFileWriteFinish(FileOperationInfo)
will be called. If
false, then they won't be called.
Default: false
shouldBeNotifiedOnFileIO
in interface EventListener
public boolean onErrorRecoveryBegin(BackgroundErrorReason backgroundErrorReason, Status backgroundError)
EventListener
onErrorRecoveryBegin
in interface EventListener
backgroundErrorReason
- background error reason codebackgroundError
- background error codesfalse
if the automatic recovery should be suppressedpublic void onErrorRecoveryCompleted(Status oldBackgroundError)
EventListener
onErrorRecoveryCompleted
in interface EventListener
oldBackgroundError
- old background error codesprotected long initializeNative(long... nativeParameterHandles)
RocksCallbackObject
initializeNative
in class RocksCallbackObject
nativeParameterHandles
- An array of native handles for any parameter
objects that are needed during constructionprotected void disposeInternal()
disposeInternal
in class RocksCallbackObject