NAME
RocksDB::WriteBatch - rocksdb::WriteBatch object
SYNOPSIS
use RocksDB;
my $db = RocksDB->new('/path/to/db');
$db->update(sub {
my $batch = shift;
$batch->put(key => 'value');
$batch->delete('key');
});
my $batch = RocksDB::WriteBatch->new;
$batch->put(key => 'value');
$batch->clear;
$batch->delete('key');
$batch->put_log_data(time());
$db->write($batch);
DESCRIPTION
RocksDB::WriteBatch is a rocksdb::WriteBatch object.
CONSTRUCTOR
RocksDB::WriteBatch->new() :RocksDB::WriteBatch
Create and return a new RocksDB::WriteBatch object.
METHODS
$batch->put($key :Str, $value :Str) :Undef
Store the mapping $key -> $value in the database.
$batch->delete($key :Str) :Undef
If the database contains a mapping for $key, erase it. Else do nothing.
$batch->put_log_data($blob :Str) :Undef
Append a blob of arbitrary size to the records in this batch. The blob will be stored in the transaction log but not in any other file. In particular, it will not be persisted to the SST files. When iterating over this WriteBatch, WriteBatchHandler::log_data will be called with the contents of the blob as it is encountered. Blobs, puts, deletes, and merges will be encountered in the same order in thich they were inserted. The blob will NOT consume sequence number(s) and will NOT increase the count of the batch
Example application: add timestamps to the transaction log for use in replication.
See also RocksDB::WriteBatchHandler.
$batch->clear() :Undef
Clear all updates buffered in this batch.
$batch->count() :Int
Returns the number of updates in the batch.
$batch->data() :Str
Retrieve the serialized version of this batch.
$batch->iterate($handler :RocksDB::WriteBatchHandler) :Undef
Support for iterating over the contents of a batch.
See RocksDB::WriteBatchHandler.
SEE ALSO
RocksDB, RocksDB::WriteBatchHandler
AUTHOR
Jiro Nishiguchi <jiro@cpan.org>