aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/distributor/min_replica_provider.h
blob: 597f9e35b8b4072f50efb9a89b22af78cc4daea3 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/vespalib/stllike/hash_map.h>

namespace storage::distributor {

using MinReplicaMap = vespalib::hash_map<uint16_t, uint32_t>;

class MinReplicaProvider
{
public:
    virtual ~MinReplicaProvider() = default;

    /**
     * Get a snapshot of the minimum bucket replica for each of the nodes.
     *
     * Can be called at any time after registration from another thread context
     * and the call must thus be thread safe and data race free.
     */
    virtual MinReplicaMap getMinReplica() const = 0;
};

void merge_min_replica_stats(MinReplicaMap & dest, const MinReplicaMap & src);

}