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

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

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

namespace proton {

CreateBucketOperation::CreateBucketOperation()
    : FeedOperation(FeedOperation::CREATE_BUCKET),
      _bucketId()
{
}


CreateBucketOperation::CreateBucketOperation(const BucketId &bucketId)
    : FeedOperation(FeedOperation::CREATE_BUCKET),
      _bucketId(bucketId)
{
}


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


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

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

} // namespace proton