aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.h
blob: 5b811f88e3e8fbb57a7cbe4955d8fe9bba51c0b1 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "documentoperation.h"

namespace proton {

class MoveOperation : public DocumentOperation
{
private:
    using DocumentSP = std::shared_ptr<document::Document>;
    DocumentSP _doc;
public:
    using UP = std::unique_ptr<MoveOperation>;

    MoveOperation();
    MoveOperation(const document::BucketId &bucketId,
                  Timestamp timestamp,
                  const DocumentSP &doc,
                  DbDocumentId sourceDbdId,
                  uint32_t targetSubDbId);
    ~MoveOperation() override;
    const DocumentSP &getDocument() const { return _doc; }
    DbDocumentId getSourceDbdId() const { return getPrevDbDocumentId(); }
    DbDocumentId getTargetDbdId() const { return getDbDocumentId(); }
    void setTargetLid(search::DocumentIdT lid) {
        setDbDocumentId(DbDocumentId(getSubDbId(), lid));
    }
    void serialize(vespalib::nbostream &os) const override;
    void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override;
    vespalib::string toString() const override;
};

} // namespace proton