aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/distributor/operations/idealstate/mergemetadata.h
blob: 07d1df4e81ca70eaea6baad96e80a5d2c140f536 (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/bucketcopy.h>

namespace vespalib { class asciistream; }

namespace storage::distributor {

struct MergeMetaData {
    uint16_t _nodeIndex;
    bool _sourceOnly;
    const BucketCopy* _copy;

    MergeMetaData() noexcept : _nodeIndex(0), _sourceOnly(false), _copy(nullptr) {}
    MergeMetaData(uint16_t nodeIndex, const BucketCopy& copy) noexcept
        : _nodeIndex(nodeIndex), _sourceOnly(false), _copy(&copy) {}

    [[nodiscard]] bool trusted() const noexcept {
        return _copy->trusted();
    }
    [[nodiscard]] uint32_t checksum() const noexcept {
        return _copy->getChecksum();
    }
    [[nodiscard]] bool source_only() const noexcept { return _sourceOnly; }
};

vespalib::asciistream& operator<<(vespalib::asciistream& out, const MergeMetaData& e);

}