Tkrzw
Public Member Functions | List of all members
tkrzw::DBMUpdateLoggerStrDeque Class Referencefinal

DBM update logger to store logs into a string deque. More...

#include <tkrzw_dbm_ulog.h>

Public Member Functions

 DBMUpdateLoggerStrDeque (const std::string &delim="\t")
 Constructor. More...
 
Status WriteSet (std::string_view key, std::string_view value) override
 Writes a log for modifying an existing record or adding a new record. More...
 
Status WriteRemove (std::string_view key) override
 Writes a log for removing an existing record. More...
 
Status WriteClear () override
 Writes a log for removing all records. More...
 
int64_t GetSize ()
 Gets the number of logs. More...
 
bool PopFront (std::string *text)
 Gets the first log in the queue and removes it. More...
 
bool PopBack (std::string *text)
 Gets the last log in the queue and removes it. More...
 
void Clear ()
 Removes all logs. More...
 
- Public Member Functions inherited from tkrzw::DBM::UpdateLogger
virtual ~UpdateLogger ()=default
 Destructor. More...
 
virtual Status Synchronize (bool hard)
 Synchronizes the metadata and content to the file system. More...
 

Detailed Description

DBM update logger to store logs into a string deque.

Constructor & Destructor Documentation

◆ DBMUpdateLoggerStrDeque()

tkrzw::DBMUpdateLoggerStrDeque::DBMUpdateLoggerStrDeque ( const std::string &  delim = "\t")
explicit

Constructor.

Parameters
delimThe delimiter put between fields in a log.

Member Function Documentation

◆ WriteSet()

Status tkrzw::DBMUpdateLoggerStrDeque::WriteSet ( std::string_view  key,
std::string_view  value 
)
overridevirtual

Writes a log for modifying an existing record or adding a new record.

Parameters
keyThe key of the record.
valueThe new value of the record.
Returns
The result status.

Implements tkrzw::DBM::UpdateLogger.

◆ WriteRemove()

Status tkrzw::DBMUpdateLoggerStrDeque::WriteRemove ( std::string_view  key)
overridevirtual

Writes a log for removing an existing record.

Parameters
keyThe key of the record.
Returns
The result status.

Implements tkrzw::DBM::UpdateLogger.

◆ WriteClear()

Status tkrzw::DBMUpdateLoggerStrDeque::WriteClear ( )
overridevirtual

Writes a log for removing all records.

Returns
The result status.

Implements tkrzw::DBM::UpdateLogger.

◆ GetSize()

int64_t tkrzw::DBMUpdateLoggerStrDeque::GetSize ( )

Gets the number of logs.

Returns
The number of logs.

◆ PopFront()

bool tkrzw::DBMUpdateLoggerStrDeque::PopFront ( std::string *  text)

Gets the first log in the queue and removes it.

Parameters
textThe pointer to a string object to store the result. If it is nullptr, assignment is not done.
Returns
True on success or false if there's no log in the queue.

◆ PopBack()

bool tkrzw::DBMUpdateLoggerStrDeque::PopBack ( std::string *  text)

Gets the last log in the queue and removes it.

Parameters
textThe pointer to a string object to store the result. If it is nullptr, assignment is not done.
Returns
True on success or false if there's no log in the queue.

◆ Clear()

void tkrzw::DBMUpdateLoggerStrDeque::Clear ( )

Removes all logs.