mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
chore: Track db_slice table memory instantly (#3375)
We update table_memory upon each deletion and insertion of an element. Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
f73c7d0e42
commit
03b3f86aed
4 changed files with 31 additions and 7 deletions
|
@ -412,6 +412,10 @@ class DbSlice {
|
|||
return version_;
|
||||
}
|
||||
|
||||
size_t table_memory() const {
|
||||
return table_memory_;
|
||||
}
|
||||
|
||||
using ChangeCallback = std::function<void(DbIndex, const ChangeReq&)>;
|
||||
|
||||
//! Registers the callback to be called for each change.
|
||||
|
@ -575,6 +579,7 @@ class DbSlice {
|
|||
ssize_t memory_budget_ = SSIZE_MAX;
|
||||
size_t bytes_per_object_ = 0;
|
||||
size_t soft_budget_limit_ = 0;
|
||||
size_t table_memory_ = 0;
|
||||
|
||||
mutable SliceEvents events_; // we may change this even for const operations.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue