aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/flushengine/iflushstrategy.h
blob: c4c49b5de13f915521830ec1a47668d26a91347b (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
44
// Copyright 2016 Yahoo Inc. 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 TlsStatsMap; }

/**
 * This class represents a strategy used by the FlushEngine to make decisions on
 * when and what to flush.
 */
class IFlushStrategy {
public:
    /**
     * Convenience typedefs.
     */
    typedef std::shared_ptr<IFlushStrategy> SP;

    IFlushStrategy(const IFlushStrategy &) = delete;
    IFlushStrategy & operator = (const IFlushStrategy &) = delete;
    /**
     * Virtual destructor required for inheritance.
     */
    virtual ~IFlushStrategy() { }

    /**
     * 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 lastSerial is the last serialnumber known by flushengine.
     * @return A prioritized list of targets to flush.
     */
    virtual FlushContext::List getFlushTargets(const FlushContext::List & targetList,
                                               const flushengine::TlsStatsMap &
                                               tlsStatsMap) const = 0;
protected:
    IFlushStrategy() = default;
};

} // namespace proton