chore: minor refactorings around dense_set deletions (#4390)

chore: refactorings around deletions

Done as a preparation to introduce asynchronous deletions for sets/zsets/hmaps.
1. Restrict the interface around DbSlice::Del. Now it requires for the iterator to be valid and the checks should
be explicit before the call. Most callers already provides a valid iterator.

2. Some minor refactoring in compact_object_test.
3. Expose DenseSet::ClearStep to allow iterative deletions of elements.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2025-01-02 11:35:55 +02:00 committed by GitHub
parent 3b082e42b8
commit 7a68528022
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 116 additions and 93 deletions

View file

@ -791,8 +791,8 @@ uint64_t CompactObj::HashCode() const {
}
if (encoded) {
GetString(&tl.tmp_str);
return XXH3_64bits_withSeed(tl.tmp_str.data(), tl.tmp_str.size(), kHashSeed);
string_view sv = GetSlice(&tl.tmp_str);
return XXH3_64bits_withSeed(sv.data(), sv.size(), kHashSeed);
}
switch (taglen_) {