blob: 5613d6c6cbdd3d2d10ddcd4ecbe54ce726a94506 (
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 Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "documentoperation.h"
#include <vespa/document/base/documentid.h>
namespace proton {
class RemoveOperation : public DocumentOperation {
protected:
explicit RemoveOperation(Type type) : DocumentOperation(type) {}
RemoveOperation(Type type, document::BucketId bucketId, Timestamp timestamp)
: DocumentOperation(type, bucketId, timestamp)
{}
public:
virtual bool hasDocType() const = 0;
virtual vespalib::stringref getDocType() const = 0;
virtual const document::GlobalId & getGlobalId() const = 0;
};
class RemoveOperationWithDocId : public RemoveOperation {
document::DocumentId _docId;
public:
RemoveOperationWithDocId();
RemoveOperationWithDocId(document::BucketId bucketId, Timestamp timestamp, const document::DocumentId &docId);
~RemoveOperationWithDocId() override;
const document::DocumentId &getDocumentId() const { return _docId; }
const document::GlobalId & getGlobalId() const override { return _docId.getGlobalId(); }
void serialize(vespalib::nbostream &os) const override;
void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override;
vespalib::string toString() const override;
bool hasDocType() const override { return _docId.hasDocType(); }
vespalib::stringref getDocType() const override { return _docId.getDocType(); }
};
class RemoveOperationWithGid : public RemoveOperation {
document::GlobalId _gid;
vespalib::string _docType;
public:
RemoveOperationWithGid();
RemoveOperationWithGid(document::BucketId bucketId, Timestamp timestamp,
const document::GlobalId & gid, vespalib::stringref docType);
~RemoveOperationWithGid() override;
const document::GlobalId & getGlobalId() const override { return _gid; }
void serialize(vespalib::nbostream &os) const override;
void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override;
vespalib::string toString() const override;
bool hasDocType() const override { return true; }
vespalib::stringref getDocType() const override { return _docType; }
};
} // namespace proton
|