blob: cd2bd6d5742aaa2b9982fc55c57f699d1e4d1280 (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
// Copyright Yahoo. 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 proton {
/**
* This class represents a collection of IFlushTarget objects. It is implemented
* by DocumentDB.
*/
class IFlushHandler {
private:
vespalib::string _name;
public:
using IFlushTarget = searchcorespi::IFlushTarget;
using SerialNum = IFlushTarget::SerialNum;
/**
* Convenience typedefs.
*/
using SP = std::shared_ptr<IFlushHandler>;
IFlushHandler(const IFlushHandler &) = delete;
IFlushHandler & operator = (const IFlushHandler &) = delete;
/**
* Constructs a new instance of this class.
*
* @param name The unique name of this handler.
*/
IFlushHandler(const vespalib::string &name) noexcept
: _name(name)
{ }
/**
* Virtual destructor required for inheritance.
*/
virtual ~IFlushHandler() = default;
/**
* Returns the unique name of this handler.
*
* @return The name of this.
*/
const vespalib::string & getName() const { return _name; }
/**
* Returns a list of the flush targets that belong to this handler. This
* method is called by the flush scheduler thread.
*
* @return The list of targets.
*/
virtual std::vector<IFlushTarget::SP> getFlushTargets() = 0;
/**
* Returns the current serial number of this handler. This is the head of
* the transaction log for the domain of this.
*
* @return The current serial number.
*/
virtual SerialNum getCurrentSerialNumber() const = 0;
/**
* This method is called after a flush has been completed. All transactions
* up to the given serial number can be pruned from the domain of this
* handler. This method is called by the flush scheduler thread.
*
* @param flushedSerial Serial number flushed for all flush
* targets belonging to this handler.
*/
virtual void flushDone(SerialNum flushedSerial) = 0;
/*
* This method is called to sync tls to stable media, up to and
* including the given serial number.
*
* @param syncTo The last serial number that has to be persisted to stable media.
*/
virtual void syncTls(SerialNum syncTo) = 0;
};
} // namespace proton
|