blob: 3473e50ec0785a678cdc6e8b1113022676c97b7c (
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
50
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "bucketdatabase.h"
#include <sstream>
namespace storage {
BucketDatabase::Entry
BucketDatabase::getNext(const document::BucketId& last) const
{
return upperBound(last);
}
BucketDatabase::Entry
BucketDatabase::createAppropriateBucket(
uint16_t minBits, const document::BucketId& bid)
{
document::BucketId newBid(getAppropriateBucket(minBits, bid));
Entry e(newBid);
update(e);
return e;
}
template <typename BucketInfoType>
std::ostream& operator<<(std::ostream& o, const BucketDatabase::EntryBase<BucketInfoType>& e)
{
if (!e.valid()) {
o << "NONEXISTING";
} else {
o << e.getBucketId() << " : " << e.getBucketInfo();
}
return o;
}
template <typename BucketInfoType>
std::string
BucketDatabase::EntryBase<BucketInfoType>::toString() const
{
std::ostringstream ost;
ost << *this;
return ost.str();
}
template std::ostream& operator<<(std::ostream& o, const BucketDatabase::Entry& e);
template std::ostream& operator<<(std::ostream& o, const BucketDatabase::ConstEntryRef& e);
template class BucketDatabase::EntryBase<BucketInfo>;
template class BucketDatabase::EntryBase<ConstBucketInfoRef>;
}
|