Class EventListener
- Namespace
- RocksDbNet
- Assembly
- RocksDb.Net.dll
Base class for receiving database event notifications such as flushes, compactions, and background errors. Override the virtual methods for events you want to observe.
public abstract class EventListener : RocksDbHandle, IDisposable
- Inheritance
-
EventListener
- Implements
- Inherited Members
Constructors
EventListener()
protected EventListener()
Properties
Subscribed
Which events this listener wants. Every one, unless a subclass narrows it.
protected virtual EventKinds Subscribed { get; }
Property Value
Remarks
This replaced a reflection check that asked, once per instance, whether
each of the ten virtuals had been overridden. The check worked, but
GetMethod by name on a runtime-known type is the shape trimming
and NativeAOT analysers object to, and it was the only reflection left in
the library.
What it bought is worth keeping, so this is the same saving stated explicitly rather than inferred: an event nobody wants costs no job-info object. That is the measurable part — a listener overriding five events allocates about twice what one overriding none does, while the boundary crossing itself costs nothing detectable.
Read when an event arrives rather than cached at construction, so an override may depend on the subclass's own fields. A virtual called from this base constructor would run before those fields were assigned.
Methods
DisposeHandle()
Releases the native handle. Called during disposal.
protected override void DisposeHandle()
Remarks
Protected rather than public: it destroys the native object without marking this instance disposed or clearing the handle, so calling it from outside and then disposing normally would free the same pointer twice. It was the most Dispose-looking member on the type. Callers want Dispose().
OnBackgroundError(BackgroundErrorInfo)
Called when a background error occurs.
public virtual void OnBackgroundError(BackgroundErrorInfo info)
Parameters
infoBackgroundErrorInfo
OnCompactionBegin(CompactionJobInfo)
Called when a compaction job begins.
public virtual void OnCompactionBegin(CompactionJobInfo info)
Parameters
infoCompactionJobInfo
OnCompactionCompleted(CompactionJobInfo)
Called when a compaction job completes.
public virtual void OnCompactionCompleted(CompactionJobInfo info)
Parameters
infoCompactionJobInfo
OnExternalFileIngested(ExternalFileIngestionInfo)
Called when an external file has been ingested.
public virtual void OnExternalFileIngested(ExternalFileIngestionInfo info)
Parameters
OnFlushBegin(FlushJobInfo)
Called when a flush job begins.
public virtual void OnFlushBegin(FlushJobInfo info)
Parameters
infoFlushJobInfo
OnFlushCompleted(FlushJobInfo)
Called when a flush job completes.
public virtual void OnFlushCompleted(FlushJobInfo info)
Parameters
infoFlushJobInfo
OnMemTableSealed(MemTableInfo)
Called when a memtable is sealed.
public virtual void OnMemTableSealed(MemTableInfo info)
Parameters
infoMemTableInfo
OnStallConditionsChanged(WriteStallInfo)
Called when write stall conditions change for a column family.
public virtual void OnStallConditionsChanged(WriteStallInfo info)
Parameters
infoWriteStallInfo
OnSubCompactionBegin(SubCompactionJobInfo)
Called when a sub-compaction job begins.
public virtual void OnSubCompactionBegin(SubCompactionJobInfo info)
Parameters
infoSubCompactionJobInfo
OnSubCompactionCompleted(SubCompactionJobInfo)
Called when a sub-compaction job completes.
public virtual void OnSubCompactionCompleted(SubCompactionJobInfo info)
Parameters
infoSubCompactionJobInfo