diff --git a/sstables/sstables.cc b/sstables/sstables.cc index 09ab91efee..193bcff8a5 100644 --- a/sstables/sstables.cc +++ b/sstables/sstables.cc @@ -4126,6 +4126,8 @@ sstable::~sstable() { } } + + _on_closed(*this); } sstring diff --git a/sstables/sstables.hh b/sstables/sstables.hh index 5a44e50153..c7500527bb 100644 --- a/sstables/sstables.hh +++ b/sstables/sstables.hh @@ -61,6 +61,7 @@ #include "db/large_partition_handler.hh" #include "column_translation.hh" #include "stats.hh" +#include "utils/observable.hh" #include @@ -388,6 +389,10 @@ public: } std::vector component_filenames() const; + utils::observer add_on_closed_handler(std::function on_closed_handler) noexcept { + return _on_closed.observe(on_closed_handler); + } + template auto sstable_write_io_check(Func&& func, Args&&... args) const { return do_io_check(_write_error_handler, func, std::forward(args)...); @@ -429,6 +434,7 @@ private: stdx::optional _first; stdx::optional _last; utils::UUID _run_identifier; + utils::observable _on_closed; lw_shared_ptr _single_partition_history = make_lw_shared(); lw_shared_ptr _partition_range_history = make_lw_shared();