Tkrzw-RPC
|
Iterator for each record. More...
#include <tkrzw_dbm_remote.h>
Public Member Functions | |
~Iterator () | |
Destructor. More... | |
Iterator (const Iterator &rhs)=delete | |
Copy and assignment are disabled. More... | |
Iterator & | operator= (const Iterator &rhs)=delete |
void | Cancel () |
Cancels the current operation. More... | |
Status | First () |
Initializes the iterator to indicate the first record. More... | |
Status | Last () |
Initializes the iterator to indicate the last record. More... | |
Status | Jump (std::string_view key) |
Initializes the iterator to indicate a specific record. More... | |
Status | JumpLower (std::string_view key, bool inclusive=false) |
Initializes the iterator to indicate the last record whose key is lower than a given key. More... | |
Status | JumpUpper (std::string_view key, bool inclusive=false) |
Initializes the iterator to indicate the first record whose key is upper than a given key. More... | |
Status | Next () |
Moves the iterator to the next record. More... | |
Status | Previous () |
Moves the iterator to the previous record. More... | |
Status | Get (std::string *key=nullptr, std::string *value=nullptr) |
Gets the key and the value of the current record of the iterator. More... | |
std::string | GetKey (std::string_view default_value="") |
Gets the key of the current record, in a simple way. More... | |
std::string | GetValue (std::string_view default_value="") |
Gets the value of the current record, in a simple way. More... | |
Status | Set (std::string_view value) |
Sets the value of the current record. More... | |
Status | Remove () |
Removes the current record. More... | |
Status | Step (std::string *key=nullptr, std::string *value=nullptr) |
Gets the current record and moves the iterator to the next record. More... | |
Friends | |
class | tkrzw::RemoteDBM |
Iterator for each record.
When the database is updated, some iterators may or may not be invalided. Operations with invalidated iterators fails gracefully with NOT_FOUND_ERROR.
An instance of this class dominates a thread on the server so you should destroy when it is no longer in use.
tkrzw::RemoteDBM::Iterator::~Iterator | ( | ) |
Destructor.
|
explicitdelete |
Copy and assignment are disabled.
void tkrzw::RemoteDBM::Iterator::Cancel | ( | ) |
Cancels the current operation.
This is called by another thread than the thread doing the operation.
Status tkrzw::RemoteDBM::Iterator::First | ( | ) |
Initializes the iterator to indicate the first record.
Even if there's no record, the operation doesn't fail.
Status tkrzw::RemoteDBM::Iterator::Last | ( | ) |
Initializes the iterator to indicate the last record.
Even if there's no record, the operation doesn't fail. This method is suppoerted only by ordered databases.
Status tkrzw::RemoteDBM::Iterator::Jump | ( | std::string_view | key | ) |
Initializes the iterator to indicate a specific record.
key | The key of the record to look for. |
Ordered databases can support "lower bound" jump; If there's no record with the same key, the iterator refers to the first record whose key is greater than the given key. The operation fails with unordered databases if there's no record with the same key.
Status tkrzw::RemoteDBM::Iterator::JumpLower | ( | std::string_view | key, |
bool | inclusive = false |
||
) |
Initializes the iterator to indicate the last record whose key is lower than a given key.
key | The key to compare with. |
inclusive | If true, the condition is inclusive: equal to or lower than the key. |
Even if there's no matching record, the operation doesn't fail. This method is suppoerted only by ordered databases.
Status tkrzw::RemoteDBM::Iterator::JumpUpper | ( | std::string_view | key, |
bool | inclusive = false |
||
) |
Initializes the iterator to indicate the first record whose key is upper than a given key.
key | The key to compare with. |
inclusive | If true, the condition is inclusive: equal to or upper than the key. |
Even if there's no matching record, the operation doesn't fail. This method is suppoerted only by ordered databases.
Status tkrzw::RemoteDBM::Iterator::Next | ( | ) |
Moves the iterator to the next record.
If the current record is missing, the operation fails. Even if there's no next record, the operation doesn't fail.
Status tkrzw::RemoteDBM::Iterator::Previous | ( | ) |
Moves the iterator to the previous record.
If the current record is missing, the operation fails. Even if there's no previous record, the operation doesn't fail. This method is suppoerted only by ordered databases.
Status tkrzw::RemoteDBM::Iterator::Get | ( | std::string * | key = nullptr , |
std::string * | value = nullptr |
||
) |
Gets the key and the value of the current record of the iterator.
key | The pointer to a string object to contain the record key. If it is nullptr, the key data is ignored. |
value | The pointer to a string object to contain the record value. If it is nullptr, the value data is ignored. |
std::string tkrzw::RemoteDBM::Iterator::GetKey | ( | std::string_view | default_value = "" | ) |
Gets the key of the current record, in a simple way.
default_value | The value to be returned on failure. |
std::string tkrzw::RemoteDBM::Iterator::GetValue | ( | std::string_view | default_value = "" | ) |
Gets the value of the current record, in a simple way.
default_value | The value to be returned on failure. |
Status tkrzw::RemoteDBM::Iterator::Set | ( | std::string_view | value | ) |
Sets the value of the current record.
value | The value of the record. |
Status tkrzw::RemoteDBM::Iterator::Remove | ( | ) |
Removes the current record.
If possible, the iterator moves to the next record.
Status tkrzw::RemoteDBM::Iterator::Step | ( | std::string * | key = nullptr , |
std::string * | value = nullptr |
||
) |
Gets the current record and moves the iterator to the next record.
key | The pointer to a string object to contain the record key. If it is nullptr, the key data is ignored. |
value | The pointer to a string object to contain the record value. If it is nullptr, the value data is ignored. |