summaryrefslogtreecommitdiffstats
path: root/storage/src/tests/distributor/bucketdatabasetest.h
blob: 33f914f8fd219766c6d816697e735dc037bcd30c (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
// 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/storage/storageutil/utils.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);
};

}