aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/server/remove_operations_rate_tracker.cpp
blob: 38b7adc68c9ca728d248a3ccc09dccb4e07582db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "remove_operations_rate_tracker.h"
#include <vespa/vespalib/util/time.h>

namespace proton {

RemoveOperationsRateTracker::RemoveOperationsRateTracker(double remove_batch_rate_threshold,
                                                         double remove_rate_threshold)
    : _remove_batch_tracker(remove_batch_rate_threshold),
      _remove_tracker(remove_rate_threshold)
{
}

void
RemoveOperationsRateTracker::notify_remove_batch()
{
    _remove_batch_tracker.observe(vespalib::steady_clock::now());
}

void
RemoveOperationsRateTracker::notify_remove()
{
    _remove_tracker.observe(vespalib::steady_clock::now());
}

bool
RemoveOperationsRateTracker::remove_batch_above_threshold() const
{
    return _remove_batch_tracker.above_threshold(vespalib::steady_clock::now());
}

bool
RemoveOperationsRateTracker::remove_above_threshold() const
{
    return _remove_tracker.above_threshold(vespalib::steady_clock::now());
}

}