8#include <userver/utils/assert.hpp>
9#include <userver/utils/fixed_array.hpp>
11USERVER_NAMESPACE_BEGIN
26class SlidingInterval final {
30 UASSERT(
this->buckets_.size() > 0);
36 buckets_[idx_] = value;
38 if (idx_ == buckets_.size()) {
47 return std::accumulate(buckets_.begin(), buckets_.end(),
49 this->buckets_.size();
56 return *std::min_element(buckets_.begin(), buckets_.end());
63 return *std::max_element(buckets_.begin(), buckets_.end());
68 [[nodiscard]] std::size_t
GetWindowSize()
const {
return buckets_.size(); }
71 utils::FixedArray<T> buckets_;