aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchcommon/attribute/i_document_meta_store_context.h
blob: 0b4d5c80a50b0feff3d260b70eb46abb5e4bf14c (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
37
38
39
40
41
42
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <memory>

namespace search {

struct IDocumentMetaStore;

/**
 * API for providing read interface to the document meta store.
 */
struct IDocumentMetaStoreContext {

    /**
     * Guard for access to the read interface.
     * This guard should be alive as long as read interface is used.
     */
    struct IReadGuard {

        using SP = std::shared_ptr<IReadGuard>;

        virtual ~IReadGuard() = default;

        /**
         * Access to read interface.
         */
        virtual const search::IDocumentMetaStore &get() const = 0;
    };

    virtual ~IDocumentMetaStoreContext() = default;

    /**
     * Access to read interface.
     * Should be used by all reader threads.
     */
    virtual IReadGuard::SP getReadGuard() const = 0;

};

}