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

#pragma once

#include <cstdint>
#include <functional>

namespace document { class GlobalId; }

namespace search {

/*
 * Interface for gid to lid mapper visitor.
 */
class IGidToLidMapperVisitor
{
public:
    virtual ~IGidToLidMapperVisitor() = default;
    virtual void visit(const document::GlobalId &gid, uint32_t lid) const = 0;
};


/*
 * Interface class for mapping from gid to lid. Instances should be short
 * lived due to implementations containing read guards preventing resource
 * reuse.
 */
class IGidToLidMapper
{
public:
    virtual ~IGidToLidMapper() = default;
    virtual void foreach(const IGidToLidMapperVisitor &visitor) const = 0;
};

} // namespace search