filter_tracker: define and call a stop method

All sharded services "should" define a stop method. Calling them is also
a good practice. For this one specifically, though, we will not call stop.
We miss a good way to add a Deleter to a shared_ptr class, and that would
be the only reliable way to tie into its lifetime.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
This commit is contained in:
Glauber Costa
2015-07-23 10:28:42 -04:00
parent b488b06fa4
commit 4cd143de87
2 changed files with 4 additions and 0 deletions

View File

@@ -16,6 +16,8 @@ namespace sstables {
future<> sstable::read_filter() {
auto ft = _filter_tracker;
return _filter_tracker->start(std::move(ft)).then([this] {
// FIXME: should stop this service. This one is definitely wrong to stop at_exit.
// We should use a Deleter class in lw_shared_ptr
if (!has_component(sstable::component_type::Filter)) {
_filter = std::make_unique<utils::filter::always_present_filter>();
return make_ready_future<>();

View File

@@ -36,6 +36,8 @@ class filter_tracker {
public:
filter_tracker(lw_shared_ptr<distributed<filter_tracker>>&& ptr) : _ptr(std::move(ptr)) {}
future<> stop() { return make_ready_future<>(); }
void add_false_positive() {
false_positive++;
}