Tkrzw
|
On-memory secondary index implementation with std::map for strings. More...
#include <tkrzw_index.h>
Classes | |
class | Iterator |
Iterator for each record. More... | |
struct | RecordComparator |
Comparator for sorting records. More... | |
Public Member Functions | |
StdIndexStr () | |
Default constructor. More... | |
~StdIndexStr () | |
Destructor. More... | |
StdIndexStr (const StdIndexStr &rhs)=delete | |
Copy and assignment are disabled. More... | |
StdIndexStr & | operator= (const StdIndexStr &rhs)=delete |
bool | Check (std::string_view key, std::string_view value) |
Checks whether a record exists in the index. More... | |
std::vector< std::string > | GetValues (std::string_view key, size_t max=0) |
Gets all values of records of a key. More... | |
void | Add (std::string_view key, std::string_view value) |
Adds a record. More... | |
void | Remove (std::string_view key, std::string_view value) |
Removes a record. More... | |
size_t | Count () |
Gets the number of records. More... | |
void | Clear () |
Removes all records. More... | |
std::unique_ptr< Iterator > | MakeIterator () |
Makes an iterator for each record. More... | |
On-memory secondary index implementation with std::map for strings.
All operations are thread-safe; Multiple threads can access the same index concurrently.
This is slower than StdIndex<string, string> although space efficiency is better.
tkrzw::StdIndexStr::StdIndexStr | ( | ) |
Default constructor.
tkrzw::StdIndexStr::~StdIndexStr | ( | ) |
Destructor.
|
explicitdelete |
Copy and assignment are disabled.
bool tkrzw::StdIndexStr::Check | ( | std::string_view | key, |
std::string_view | value | ||
) |
Checks whether a record exists in the index.
key | The key of the record. |
value | The value of the record. |
std::vector< std::string > tkrzw::StdIndexStr::GetValues | ( | std::string_view | key, |
size_t | max = 0 |
||
) |
Gets all values of records of a key.
key | The key to look for. |
max | The maximum number of values to get. 0 means unlimited. |
void tkrzw::StdIndexStr::Add | ( | std::string_view | key, |
std::string_view | value | ||
) |
Adds a record.
key | The key of the record. This can be an arbitrary expression to search the index. |
value | The value of the record. This should be a primary value of another database. |
void tkrzw::StdIndexStr::Remove | ( | std::string_view | key, |
std::string_view | value | ||
) |
Removes a record.
key | The key of the record. |
value | The value of the record. |
size_t tkrzw::StdIndexStr::Count | ( | ) |
Gets the number of records.
void tkrzw::StdIndexStr::Clear | ( | ) |
Removes all records.
std::unique_ptr< StdIndexStr::Iterator > tkrzw::StdIndexStr::MakeIterator | ( | ) |
Makes an iterator for each record.