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

#include "bucketfactory.h"
#include <vespa/persistence/spi/test.h>

using document::BucketId;
using document::DocumentId;
using storage::spi::Bucket;
using storage::spi::test::makeSpiBucket;

namespace proton {

BucketId
BucketFactory::getBucketId(const DocumentId &docId)
{
    BucketId bId = docId.getGlobalId().convertToBucketId();
    bId.setUsedBits(getNumBucketBits());
    return bId;
}


Bucket
BucketFactory::getBucket(const DocumentId &docId)
{
    return makeSpiBucket(getBucketId(docId));
}

} // namespace proton