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

#include <vespa/storageapi/message/bucket.h>

namespace storage {

/*
 * Class for remapping bit masks from a partial set of nodes to a full
 * set of nodes.
 */
class HasMaskRemapper
{
    std::vector<uint16_t> _mask_remap;
    uint16_t _all_remapped;

public:
    HasMaskRemapper(const std::vector<api::MergeBucketCommand::Node> &all_nodes,
                 const std::vector<api::MergeBucketCommand::Node> &nodes);
    ~HasMaskRemapper();

    uint16_t operator()(uint16_t mask) const;
    uint16_t operator()(uint16_t mask, uint16_t keep_from_full_mask) const;
};

}