blob: 5f1780c30ed65bff4e37c0d43e994565c49ac2d3 (
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
40
41
42
43
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "iflushhandler.h"
#include "flushcontext.h"
namespace proton {
namespace flushengine {
class ActiveFlushStats;
class TlsStatsMap;
}
/**
* This class represents a strategy used by the FlushEngine to make decisions on
* when and what to flush.
*/
class IFlushStrategy {
public:
using SP = std::shared_ptr<IFlushStrategy>;
IFlushStrategy(const IFlushStrategy &) = delete;
IFlushStrategy & operator = (const IFlushStrategy &) = delete;
virtual ~IFlushStrategy() = default;
/**
* Takes an input of targets that are candidates for flush and returns
* a list of targets sorted according to priority strategy.
* @param targetList The list of possible flush targets.
* @param tlsStatsMap Statistics per domain in the TLS. A domain matches a flush handler.
* @parma active_flushes Statistics of active (ongoing) flushes per flush handler.
* @return A prioritized list of targets to flush.
*/
virtual FlushContext::List getFlushTargets(const FlushContext::List& targetList,
const flushengine::TlsStatsMap& tlsStatsMap,
const flushengine::ActiveFlushStats& active_flushes) const = 0;
protected:
IFlushStrategy() = default;
};
}
|