aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/tests/distributor/bucketdatabasetest.h
blob: f24a62728d3b5eb9af77cd94c69181d8069a3165 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/storage/bucketdb/bucketdatabase.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <functional>

namespace storage::distributor {

struct BucketDatabaseTest : public ::testing::TestWithParam<std::shared_ptr<BucketDatabase>> {
    void SetUp() override ;

    std::string doFindParents(const std::vector<document::BucketId>& ids, const document::BucketId& searchId);
    std::string doFindAll(const std::vector<document::BucketId>& ids, const document::BucketId& searchId);
    document::BucketId doCreate(const std::vector<document::BucketId>& ids,
                                uint32_t minBits, const document::BucketId& wantedId);

    BucketDatabase& db() noexcept { return *GetParam(); }

    using UBoundFunc = std::function<document::BucketId(const BucketDatabase&, const document::BucketId&)>;

    void doTestUpperBound(const UBoundFunc& f);
};

}