aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/server/replay_throttling_policy.h
blob: 8f35262795c5f5fa9d4c01cf0293e371ae7f3cbe (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/vespalib/util/shared_operation_throttler.h>
#include <optional>

namespace proton {

/*
 * Policy for transaction log replay throttling. If params are set then a dynamic throttler
 * is used, otherwise an unlimited throttler is used.
 */
class ReplayThrottlingPolicy
{
    using DynamicThrottleParams = vespalib::SharedOperationThrottler::DynamicThrottleParams;
    std::optional<DynamicThrottleParams> _params;

public:
    explicit ReplayThrottlingPolicy(std::optional<DynamicThrottleParams> params)
        : _params(std::move(params))
    {
    }
    const std::optional<DynamicThrottleParams>& get_params() const noexcept {  return _params; }
};

}