mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
Add HKEYS command. Account for listpack blobs
This commit is contained in:
parent
b3e5730377
commit
2213c1b38b
9 changed files with 255 additions and 36 deletions
|
@ -42,6 +42,8 @@ struct DbStats {
|
|||
|
||||
size_t small_string_bytes = 0;
|
||||
|
||||
size_t listpack_blob_cnt = 0;
|
||||
size_t listpack_bytes = 0;
|
||||
DbStats& operator+=(const DbStats& o);
|
||||
};
|
||||
|
||||
|
@ -54,14 +56,6 @@ struct SliceEvents {
|
|||
};
|
||||
|
||||
class DbSlice {
|
||||
struct InternalDbStats {
|
||||
// Number of inline keys.
|
||||
uint64_t inline_keys = 0;
|
||||
|
||||
// Object memory usage besides hash-table capacity.
|
||||
// Applies for any non-inline objects.
|
||||
size_t obj_memory_usage = 0;
|
||||
};
|
||||
|
||||
DbSlice(const DbSlice&) = delete;
|
||||
void operator=(const DbSlice&) = delete;
|
||||
|
@ -72,6 +66,18 @@ class DbSlice {
|
|||
SliceEvents events;
|
||||
};
|
||||
|
||||
struct InternalDbStats {
|
||||
// Number of inline keys.
|
||||
uint64_t inline_keys = 0;
|
||||
|
||||
// Object memory usage besides hash-table capacity.
|
||||
// Applies for any non-inline objects.
|
||||
size_t obj_memory_usage = 0;
|
||||
size_t listpack_blob_cnt = 0;
|
||||
size_t listpack_bytes = 0;
|
||||
};
|
||||
|
||||
|
||||
DbSlice(uint32_t index, EngineShard* owner);
|
||||
~DbSlice();
|
||||
|
||||
|
@ -165,6 +171,10 @@ class DbSlice {
|
|||
void PreUpdate(DbIndex db_ind, MainIterator it);
|
||||
void PostUpdate(DbIndex db_ind, MainIterator it);
|
||||
|
||||
InternalDbStats* MutableStats(DbIndex db_ind) {
|
||||
return &db_arr_[db_ind]->stats;
|
||||
}
|
||||
|
||||
// Check whether 'it' has not expired. Returns it if it's still valid. Otherwise, erases it
|
||||
// from both tables and return MainIterator{}.
|
||||
std::pair<MainIterator, ExpireIterator> ExpireIfNeeded(DbIndex db_ind, MainIterator it) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue