RocksDB::CompactionFilter - rocksdb::CompactionFilter object
use RocksDB; my $handler = MyCompactionFilter->new; my $db = RocksDB->new('/path/to/db', { create_if_missing => 1, compaction_filter => RocksDB::CompactionFilter->new($handler), });
RocksDB::CompactionFilter is a utility class to make rocksdb::CompactionFilter object.
RocksDB::CompactionFilter->new($handler :Object) :RocksDB::CompactionFilter
Create and return a new RocksDB::CompactionFilter object.
The $handler must respond to 'filter'.
See 'HANDLER METHODS' section for more details.
$handler->filter($level :Int, $key :Str, $existing_value :Maybe[Str], $new_value_ref :Str) :Bool
The compaction process invokes this method for kv that is being compacted. A return value of false indicates that the kv should be preserved in the output of this compaction run and a return value of true indicates that this key-value should be removed from the output of the compaction. The application can inspect the existing value of the key and make decision based on it.
When the value is to be preserved, the application has the option to modify the existing_value and pass it back through new_value_ref.
If multithreaded compaction is being used *and* a single CompactionFilter instance was supplied via compaction_filter, this method may be called from different threads concurrently. The application must ensure that the call is thread-safe.
If the CompactionFilter was created by a factory, then it will only ever be used by a single thread that is doing the compaction run, and this call does not need to be thread-safe. However, multiple filters may be in existence and operating concurrently.
RocksDB
Jiro Nishiguchi <jiro@cpan.org>
To install RocksDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RocksDB
CPAN shell
perl -MCPAN -e shell install RocksDB
For more information on module installation, please visit the detailed CPAN module installation guide.