aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcorespi/index/indexfusiontarget.h
blob: 2be7bcc33a9b78fec0f7a86c118a52729a2594f6 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "indexmaintainer.h"
#include <vespa/searchcorespi/flush/iflushtarget.h>

namespace searchcorespi::index {

/**
 * Flush target for doing fusion on disk indexes in an IndexMaintainer.
 **/
class IndexFusionTarget : public LeafFlushTarget {
private:
    IndexMaintainer &_indexMaintainer;
    IndexMaintainer::FusionStats _fusionStats;
    FlushStats _lastStats;

public:
    IndexFusionTarget(IndexMaintainer &indexMaintainer);
    ~IndexFusionTarget() override;

    // Implements IFlushTarget
    MemoryGain getApproxMemoryGain() const override;
    DiskGain   getApproxDiskGain() const override;
    SerialNum getFlushedSerialNum() const override;
    Time    getLastFlushTime() const override;
    bool           needUrgentFlush() const override;

    Task::UP initFlush(SerialNum currentSerial, std::shared_ptr<search::IFlushToken> flush_token) override;
    FlushStats getLastFlushStats() const override { return _lastStats; }
    uint64_t getApproxBytesToWriteToDisk() const override;
};

}