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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "storeonlyfeedview.h"
#include <vespa/searchcore/proton/attribute/i_attribute_writer.h>
#include <vespa/searchcore/proton/common/docid_limit.h>
namespace proton {
/**
* The feed view used by the fast-access sub database.
*
* Handles inserting/updating/removing of documents to the underlying
* fast-access attributes and document store.
*/
class FastAccessFeedView : public StoreOnlyFeedView
{
public:
using SP = std::shared_ptr<FastAccessFeedView>;
using UP = std::unique_ptr<FastAccessFeedView>;
struct Context
{
const IAttributeWriter::SP _attrWriter;
DocIdLimit &_docIdLimit;
Context(IAttributeWriter::SP attrWriter, DocIdLimit &docIdLimit)
: _attrWriter(std::move(attrWriter)),
_docIdLimit(docIdLimit)
{ }
};
private:
using Parent = StoreOnlyFeedView;
const IAttributeWriter::SP _attributeWriter;
DocIdLimit &_docIdLimit;
void putAttributes(SerialNum serialNum, search::DocumentIdT lid, const Document &doc, OnPutDoneType onWriteDone) override;
void updateAttributes(SerialNum serialNum, search::DocumentIdT lid, const document::DocumentUpdate &upd,
OnOperationDoneType onWriteDone, IFieldUpdateCallback & onUpdate) override;
void updateAttributes(SerialNum serialNum, Lid lid, FutureDoc doc, OnOperationDoneType onWriteDone) override;
void removeAttributes(SerialNum serialNum, search::DocumentIdT lid, OnRemoveDoneType onWriteDone) override;
void removeAttributes(SerialNum serialNum, const LidVector &lidsToRemove, OnWriteDoneType onWriteDone) override;
void heartBeatAttributes(SerialNum serialNum, DoneCallback onDone) override;
protected:
void internalForceCommit(const CommitParam & param, OnForceCommitDoneType onCommitDone) override;
public:
FastAccessFeedView(StoreOnlyFeedView::Context storeOnlyCtx, const PersistentParams ¶ms, const Context &ctx);
~FastAccessFeedView() override;
virtual const IAttributeWriter::SP &getAttributeWriter() const {
return _attributeWriter;
}
virtual DocIdLimit &getDocIdLimit() const {
return _docIdLimit;
}
void handleCompactLidSpace(const CompactLidSpaceOperation &op, DoneCallback onDone) override;
};
} // namespace proton
|