|
Tkrzw
|
On-memory secondary index implementation with BabyDBM. More...
#include <tkrzw_index.h>
Classes | |
| class | Iterator |
| Iterator for each record. More... | |
Public Member Functions | |
| MemIndex (KeyComparator key_comparator=PairLexicalKeyComparator) | |
| Constructor. More... | |
| MemIndex (const MemIndex &rhs)=delete | |
| Copy and assignment are disabled. More... | |
| MemIndex & | operator= (const MemIndex &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 BabyDBM.
All operations are thread-safe; Multiple threads can access the same index concurrently.
|
explicit |
Constructor.
| key_comparator | The comparator of record keys. |
Compatible key comparators are PairLexicalKeyComparator, PairLexicalCaseKeyComparator, PairDecimalKeyComparator, PairHexadecimalKeyComparator, PairRealNumberKeyComparator, and PairFloatBigEndianKeyComparator.
|
explicitdelete |
Copy and assignment are disabled.
| bool tkrzw::MemIndex::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::MemIndex::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::MemIndex::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::MemIndex::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::MemIndex::Count | ( | ) |
Gets the number of records.
| void tkrzw::MemIndex::Clear | ( | ) |
Removes all records.
| std::unique_ptr< MemIndex::Iterator > tkrzw::MemIndex::MakeIterator | ( | ) |
Makes an iterator for each record.