blob: 7f8e8adb9023747c460e08326ab11b48c95891ca (
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
55
56
57
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "i_job_tracker.h"
#include <vespa/searchcorespi/flush/iflushtarget.h>
namespace proton {
/**
* Class that tracks the start and end of an init flush in a flush target.
* The returned flush task is also tracked.
*/
class JobTrackedFlushTarget : public searchcorespi::IFlushTarget
{
private:
std::shared_ptr<IJobTracker> _tracker;
std::shared_ptr<searchcorespi::IFlushTarget> _target;
public:
JobTrackedFlushTarget(std::shared_ptr<IJobTracker> tracker,
std::shared_ptr<searchcorespi::IFlushTarget> target);
~JobTrackedFlushTarget() override;
const IJobTracker &getTracker() const { return *_tracker; }
const searchcorespi::IFlushTarget &getTarget() const { return *_target; }
// Implements searchcorespi::IFlushTarget
MemoryGain getApproxMemoryGain() const override {
return _target->getApproxMemoryGain();
}
DiskGain getApproxDiskGain() const override {
return _target->getApproxDiskGain();
}
SerialNum getFlushedSerialNum() const override {
return _target->getFlushedSerialNum();
}
Time getLastFlushTime() const override {
return _target->getLastFlushTime();
}
bool needUrgentFlush() const override {
return _target->needUrgentFlush();
}
double get_replay_operation_cost() const override {
return _target->get_replay_operation_cost();
}
Priority getPriority() const override { return _target->getPriority(); }
searchcorespi::FlushTask::UP initFlush(SerialNum currentSerial, std::shared_ptr<search::IFlushToken> flush_token) override;
searchcorespi::FlushStats getLastFlushStats() const override {
return _target->getLastFlushStats();
}
uint64_t getApproxBytesToWriteToDisk() const override {
return _target->getApproxBytesToWriteToDisk();
}
};
} // namespace proton
|