mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
logalloc: relax lifetime rules around region_listener
Currently, a region_listener is added during construction and removed during destruction. This was done to mimick the old region(region_group&) constructor, as region_listener replaces region_group. However, this makes moving the binomial heap handle outside logalloc difficult. The natural place for the handle is in a derived class of logalloc::region (e.g. memtable), but members of this derived class will be destroyed earlier than the logalloc::region here. We could play trickes with an earlier base class but it's better to just decouple region lifecycle from listener lifecycle. Do that be adding listen()/unlisten() methods. Some small awkwardness remains in that merge() implicitly unlistens (see comment in region::unlisten). Unit tests are adjusted.
This commit is contained in:
@@ -301,12 +301,14 @@ private:
|
||||
const region_impl& get_impl() const;
|
||||
public:
|
||||
region();
|
||||
explicit region(region_listener& listener);
|
||||
~region();
|
||||
region(region&& other);
|
||||
region& operator=(region&& other);
|
||||
region(const region& other) = delete;
|
||||
|
||||
void listen(region_listener* listener);
|
||||
void unlisten();
|
||||
|
||||
occupancy_stats occupancy() const;
|
||||
|
||||
allocation_strategy& allocator() noexcept {
|
||||
|
||||
Reference in New Issue
Block a user