aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcorespi/index/index_disk_dir.h
blob: 7657656b0c849c95af94dc1be1c64811022b2a49 (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
35
36
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

namespace searchcorespi::index {

/*
 * Class naming a disk index for a document type.
 */
class IndexDiskDir {
    uint32_t _id;
    bool     _fusion;
public:
    IndexDiskDir(uint32_t id, bool fusion) noexcept
        : _id(id),
          _fusion(fusion)
    {
    }
    IndexDiskDir() noexcept
        : IndexDiskDir(0, false)
    {
    }
    bool operator<(const IndexDiskDir& rhs) const noexcept {
        if (_id != rhs._id) {
            return _id < rhs._id;
        }
        return !_fusion && rhs._fusion;
    }
    bool operator==(const IndexDiskDir& rhs) const noexcept {
        return (_id == rhs._id) && (_fusion == rhs._fusion);
    }
    bool valid() const noexcept { return _id != 0u; }
    bool is_fusion_index() const noexcept { return _fusion; }
    uint64_t get_id() const noexcept { return _id; }
};

}