aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storageapi/messageapi/bucketreply.cpp
blob: 08b5effbd11b36afe21bd546574f68b09c22733b (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "bucketreply.h"
#include "bucketcommand.h"
#include <ostream>

using document::Bucket;
using document::BucketId;

namespace storage::api {

void
BucketReply::remapBucketId(const BucketId& bucket) {
    if (_originalBucket.getRawId() == 0) {
        _originalBucket = _bucket.getBucketId();
    }
    Bucket newBucket(_bucket.getBucketSpace(), bucket);
    _bucket = newBucket;
}

void
BucketReply::print(std::ostream& out, bool verbose,
                   const std::string& indent) const
{
    out << "BucketReply(" << _bucket.getBucketId();
    if (hasBeenRemapped()) {
        out << " <- " << _originalBucket;
    }
    out << ")";
    if (verbose) {
        out << " : ";
        StorageReply::print(out, verbose, indent);
    }
}

}