aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/common/alloc_config.h
blob: 79a6cc5116483266eaeb15dc35b47c4fb1ea195f (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "alloc_strategy.h"

namespace proton {

enum class SubDbType;

/*
 * Class representing allocation config for proton which can be used
 * to make an allocation strategy for large data structures owned by a 
 * document sub db (e.g. attribute vectors, document meta store).
 */
class AllocConfig
{
    AllocStrategy  _alloc_strategy; // baseline before adjusting for redundancy / searchable copies
    const uint32_t _redundancy;
    const uint32_t _searchable_copies;

public:
    AllocConfig(const AllocStrategy& alloc_strategy, uint32_t redundancy, uint32_t searchable_copies);
    ~AllocConfig();

    bool operator==(const AllocConfig &rhs) const noexcept;
    bool operator!=(const AllocConfig &rhs) const noexcept {
        return !operator==(rhs);
    }
    AllocStrategy make_alloc_strategy(SubDbType sub_db_type) const;
    static AllocConfig makeDefault() { return AllocConfig(AllocStrategy(), 1, 1); }
};

}