Added Scan() to go through the dualkey map
This commit is contained in:
@@ -124,7 +124,7 @@ public:
|
|||||||
return amountDeleted;
|
return amountDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard("Discarding an expensive operation's result!")]]
|
[[nodiscard("Discarding an expensive query!")]]
|
||||||
std::vector<QueryResult> query(std::optional<AKey> firstKey,
|
std::vector<QueryResult> query(std::optional<AKey> firstKey,
|
||||||
std::optional<BKey> secondKey) {
|
std::optional<BKey> secondKey) {
|
||||||
bool isFirstKeyGiven = firstKey.has_value();
|
bool isFirstKeyGiven = firstKey.has_value();
|
||||||
@@ -180,6 +180,18 @@ public:
|
|||||||
return finishedQuery;
|
return finishedQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
scan(std::function<bool(const AKey &, const BKey &, Value &)> scanFunction) {
|
||||||
|
for (DualkeyHash *hash : hashList) {
|
||||||
|
if (hash == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (scanFunction(hash->firstKey, hash->secondKey, hash->value)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
std::size_t count() {
|
std::size_t count() {
|
||||||
return hashList.size() - graveyard.size();
|
return hashList.size() - graveyard.size();
|
||||||
|
|||||||
Reference in New Issue
Block a user