aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/reference/i_document_db_reference_registry.h
blob: aab43d203041702d5a66ca2d271d77a34b4a6d2f (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 Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/vespalib/stllike/string.h>
#include <memory>

namespace proton {

class IDocumentDBReference;

/*
 * Interface class for a registry of named IDocumentDBReferences.
 */
class IDocumentDBReferenceRegistry
{
public:
    virtual ~IDocumentDBReferenceRegistry() = default;

    /*
     * Get named IDocumentDBReference.  Block while it doesn't exist.
     */
    virtual std::shared_ptr<IDocumentDBReference> get(vespalib::stringref name) const = 0;

    /*
     * Get named IDocumentDBReference.  Returns empty shared pointer if
     * it doesn't exist.
     */
    virtual std::shared_ptr<IDocumentDBReference> tryGet(vespalib::stringref name) const = 0;

    virtual void add(vespalib::stringref name, std::shared_ptr<IDocumentDBReference> referee) = 0;

    virtual void remove(vespalib::stringref name) = 0;
};

} // namespace proton