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

#include "protocolserialization6_0.h"
#include "serializationhelper.h"

namespace storage::mbusprot {

ProtocolSerialization6_0::ProtocolSerialization6_0(const std::shared_ptr<const document::DocumentTypeRepo> &repo)
    : ProtocolSerialization5_2(repo)
{
}

document::Bucket
ProtocolSerialization6_0::getBucket(document::ByteBuffer &buf) const
{
    document::BucketSpace bucketSpace(SH::getLong(buf));
    document::BucketId bucketId(SH::getLong(buf));
    return document::Bucket(bucketSpace, bucketId);
}

void
ProtocolSerialization6_0::putBucket(const document::Bucket &bucket, vespalib::GrowableByteBuffer &buf) const
{
    buf.putLong(bucket.getBucketSpace().getId());
    buf.putLong(bucket.getBucketId().getRawId());
}

document::BucketSpace
ProtocolSerialization6_0::getBucketSpace(document::ByteBuffer &buf) const
{
    return document::BucketSpace(SH::getLong(buf));
}

void
ProtocolSerialization6_0::putBucketSpace(document::BucketSpace bucketSpace, vespalib::GrowableByteBuffer &buf) const
{
    buf.putLong(bucketSpace.getId());
}

}