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

#include "removedocumentsoperation.h"
#include <vespa/vespalib/objects/nbostream.h>

namespace proton {

RemoveDocumentsOperation::RemoveDocumentsOperation(Type type)
    : FeedOperation(type),
      _lidsToRemoveMap()
{
}


void
RemoveDocumentsOperation::serializeLidsToRemove(vespalib::nbostream &os) const
{
    uint32_t mapSize = _lidsToRemoveMap.size();
    os << mapSize;
    for (const auto & entry : _lidsToRemoveMap) {
        os << entry.first;
        entry.second->serialize(os);
    }
}


void
RemoveDocumentsOperation::deserializeLidsToRemove(vespalib::nbostream &is)
{
    uint32_t mapSize;
    uint32_t i;
    is >> mapSize;
    for (i = 0; i < mapSize; ++i) {
        uint32_t subDbId;
        is >> subDbId;
        auto lidsToRemove = std::make_shared<LidVectorContext>();
        lidsToRemove->deserialize(is);
        setLidsToRemove(subDbId, lidsToRemove);
    }
}


} // namespace proton