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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/searchlib/common/serialnum.h>
#include <vespa/vespalib/stllike/string.h>
#include <memory>
namespace document { class DocumentTypeRepo; }
namespace vespalib { class nbostream; }
namespace proton {
class FeedOperation
{
public:
using SerialNum = search::SerialNum;
using SP = std::shared_ptr<FeedOperation>;
using UP = std::unique_ptr<FeedOperation>;
/*
* Enumeration of feed operations. UPDATE_42 is partial update
* without support for field path updates (kept to support replay
* of old transaction logs). UPDATE is partial update with
* support for field paths updates.
*/
enum Type {
PUT = 1,
REMOVE = 2,
REMOVE_BATCH = 3,
UPDATE_42 = 4,
NOOP = 5,
NEW_CONFIG = 6,
WIPE_HISTORY = 7,
DELETE_BUCKET = 9,
SPLIT_BUCKET = 10,
JOIN_BUCKETS = 11,
PRUNE_REMOVED_DOCUMENTS = 12,
MOVE = 15,
CREATE_BUCKET = 16,
COMPACT_LID_SPACE = 17,
UPDATE = 18,
REMOVE_GID = 19
};
private:
Type _type;
SerialNum _serialNum;
public:
FeedOperation(Type type) noexcept
: _type(type),
_serialNum(0)
{ }
virtual ~FeedOperation() = default;
Type getType() const { return _type; }
void setSerialNum(SerialNum serialNum) { _serialNum = serialNum; }
SerialNum getSerialNum() const { return _serialNum; }
virtual void serialize(vespalib::nbostream &os) const = 0;
virtual void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) = 0;
virtual vespalib::string toString() const = 0;
};
} // namespace proton
|