Tkrzw
Public Member Functions | Static Public Attributes | List of all members
tkrzw::DBM::RecordProcessor Class Reference

Interface of processor for a record. More...

#include <tkrzw_dbm.h>

Public Member Functions

virtual ~RecordProcessor ()=default
 Destructor. More...
 
virtual std::string_view ProcessFull (std::string_view key, std::string_view value)
 Processes an existing record. More...
 
virtual std::string_view ProcessEmpty (std::string_view key)
 Processes an empty record space. More...
 

Static Public Attributes

static const std::string_view NOOP
 The special string indicating no operation. More...
 
static const std::string_view REMOVE
 The special string indicating removing operation. More...
 

Detailed Description

Interface of processor for a record.

Constructor & Destructor Documentation

◆ ~RecordProcessor()

virtual tkrzw::DBM::RecordProcessor::~RecordProcessor ( )
virtualdefault

Destructor.

Reimplemented in tkrzw::AsyncDBM::RecordProcessor.

Member Function Documentation

◆ ProcessFull()

virtual std::string_view tkrzw::DBM::RecordProcessor::ProcessFull ( std::string_view  key,
std::string_view  value 
)
virtual

Processes an existing record.

Parameters
keyThe key of the existing record.
valueThe value of the existing record.
Returns
A string reference to NOOP, REMOVE, or a string of a new value.

The memory referred to by the return value must be alive until the end of the life-span of this object or until this function is called next time.

Reimplemented in tkrzw::DBM::RecordProcessorIterator, tkrzw::DBM::RecordProcessorExport, tkrzw::DBM::RecordProcessorPopFirst, tkrzw::DBM::RecordSetterRekey, tkrzw::DBM::RecordRemoverRekey, tkrzw::DBM::RecordCheckerRekey, tkrzw::DBM::RecordSetterCompareExchangeMulti, tkrzw::DBM::RecordCheckerCompareExchangeMulti, tkrzw::DBM::RecordProcessorIncrement, tkrzw::DBM::RecordProcessorCompareExchange, tkrzw::DBM::RecordProcessorAppend, tkrzw::DBM::RecordProcessorRemove, tkrzw::DBM::RecordProcessorSet, tkrzw::DBM::RecordProcessorGet, and tkrzw::DBM::RecordProcessorLambda.

◆ ProcessEmpty()

virtual std::string_view tkrzw::DBM::RecordProcessor::ProcessEmpty ( std::string_view  key)
virtual

Processes an empty record space.

Parameters
keyThe key specified by the caller.
Returns
A string reference to NOOP, REMOVE, or the new value.

The memory referred to by the return value must be alive until the end of the life-span of this object or until this function is called next time.

Reimplemented in tkrzw::DBM::RecordSetterRekey, tkrzw::DBM::RecordRemoverRekey, tkrzw::DBM::RecordCheckerRekey, tkrzw::DBM::RecordSetterCompareExchangeMulti, tkrzw::DBM::RecordCheckerCompareExchangeMulti, tkrzw::DBM::RecordProcessorIncrement, tkrzw::DBM::RecordProcessorCompareExchange, tkrzw::DBM::RecordProcessorAppend, tkrzw::DBM::RecordProcessorRemove, tkrzw::DBM::RecordProcessorSet, tkrzw::DBM::RecordProcessorGet, and tkrzw::DBM::RecordProcessorLambda.

Member Data Documentation

◆ NOOP

const std::string_view tkrzw::DBM::RecordProcessor::NOOP
static

The special string indicating no operation.

The uniqueness comes from the address of the data region. So, checking should be done like your_value.data() == NOOP.data().

◆ REMOVE

const std::string_view tkrzw::DBM::RecordProcessor::REMOVE
static

The special string indicating removing operation.

The uniqueness comes from the address of the data region. So, checking should be done like your_value.data() == REMOVE.data().