Class CompactionFilterFactory
- Namespace
- RocksDbNet
- Assembly
- RocksDb.Net.dll
Creates a fresh CompactionFilter for each compaction / flush job. Preferred over sharing a single filter instance when the filter contains per-compaction state or when thread-safe access to a shared instance is not practical.
public abstract class CompactionFilterFactory : RocksDbHandle, IDisposable
- Inheritance
-
CompactionFilterFactory
- Implements
- Inherited Members
Remarks
Lifetime: After passing the factory to
CompactionFilterFactory, the C++ options object
shares ownership of it through a shared_ptr. Disposing the factory
is safe at any point: attaching registers a hold, so a using block
that ends first defers the release rather than performing it.
Constructors
CompactionFilterFactory(string)
protected CompactionFilterFactory(string name)
Parameters
namestring
Methods
CreateFilter(CompactionFilterContext)
Creates a new CompactionFilter for the given compaction job. Return a freshly constructed instance on every call; do not share instances between jobs. RocksDb owns the returned filter's lifetime — do not dispose the returned filter.
protected abstract CompactionFilter CreateFilter(CompactionFilterContext context)
Parameters
contextCompactionFilterContext
Returns
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().