blob: a0e012274af7c28402e989212b78142632c8e902 (
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
45
46
47
48
49
50
51
52
53
54
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/searchcorespi/flush/iflushtarget.h>
namespace search::common { struct ICompactableLidSpace; }
namespace proton {
/**
* Implements a flush target that shrinks lid space in target.
*/
class ShrinkLidSpaceFlushTarget : public searchcorespi::LeafFlushTarget
{
/**
* Task representing that shrinking has been performed.
**/
class Flusher;
using ICompactableLidSpace = search::common::ICompactableLidSpace;
using FlushStats = searchcorespi::FlushStats;
std::shared_ptr<ICompactableLidSpace> _target;
SerialNum _flushedSerialNum;
Time _lastFlushTime;
FlushStats _lastStats;
public:
/**
* Constructs a new instance of this class.
*
* @param name The handler-wide unique name of this target.
* @param type The flush type of this target.
* @param component The component type of this target.
* @param flushedSerialNum When target shrank lid space last time
* @param target The target supporting lid space compaction
*/
ShrinkLidSpaceFlushTarget(const vespalib::string &name,
Type type,
Component component,
SerialNum flushedSerialNum,
Time lastFlushTime,
std::shared_ptr<ICompactableLidSpace> target);
// Implements IFlushTarget.
MemoryGain getApproxMemoryGain() const override;
DiskGain getApproxDiskGain() const override;
SerialNum getFlushedSerialNum() const override;
Time getLastFlushTime() const override;
Task::UP initFlush(SerialNum currentSerial, std::shared_ptr<search::IFlushToken> flush_token) override;
searchcorespi::FlushStats getLastFlushStats() const override;
uint64_t getApproxBytesToWriteToDisk() const override;
};
} // namespace proton
|