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

#include "deletebucketoperation.h"
#include <vespa/vespalib/util/stringfmt.h>
#include <cassert>

using document::BucketId;
using document::DocumentTypeRepo;
using vespalib::make_string;

namespace proton {

DeleteBucketOperation::DeleteBucketOperation()
    : RemoveDocumentsOperation(FeedOperation::DELETE_BUCKET),
      _bucketId()
{
}


DeleteBucketOperation::DeleteBucketOperation(const BucketId &bucketId)
    : RemoveDocumentsOperation(FeedOperation::DELETE_BUCKET),
      _bucketId(bucketId)
{
}


void
DeleteBucketOperation::serialize(vespalib::nbostream &os) const
{
    assert(_bucketId.valid());
    os << _bucketId;
    serializeLidsToRemove(os);
}


void
DeleteBucketOperation::deserialize(vespalib::nbostream &is,
                                   const DocumentTypeRepo &)
{
    is >> _bucketId;
    deserializeLidsToRemove(is);
}

vespalib::string DeleteBucketOperation::toString() const {
    return make_string("DeleteBucket(%s, serialNum=%" PRIu64 ")",
                       _bucketId.toString().c_str(), getSerialNum());
}

} // namespace proton