blob: 580c2ac931d9e01ca03d57df62021d176712d729 (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "i_document_db_reference_registry.h"
#include <mutex>
#include <condition_variable>
#include <map>
namespace proton {
/*
* Class implementing a registry of named IDocumentDBReferences.
*/
class DocumentDBReferenceRegistry : public IDocumentDBReferenceRegistry
{
mutable std::mutex _lock;
mutable std::condition_variable _cv;
std::map<vespalib::string, std::shared_ptr<IDocumentDBReference>> _handlers;
public:
DocumentDBReferenceRegistry();
virtual ~DocumentDBReferenceRegistry();
virtual std::shared_ptr<IDocumentDBReference> get(vespalib::stringref docType) const override;
virtual std::shared_ptr<IDocumentDBReference> tryGet(vespalib::stringref docType) const override;
virtual void add(vespalib::stringref name, std::shared_ptr<IDocumentDBReference> referee) override;
virtual void remove(vespalib::stringref name) override;
};
} // namespace proton
|