-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathMetaStoreJSONConfigRepository.h
58 lines (39 loc) · 1.59 KB
/
MetaStoreJSONConfigRepository.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include <Coordination/MetaStoreDispatcher.h>
#include <Interpreters/IExternalLoaderConfigRepository.h>
#include <base/types.h>
#include "config.h"
#include <mutex>
#include <unordered_set>
#include <Poco/Timestamp.h>
namespace DB
{
namespace Streaming
{
/// JSON config repository via MetaStore used by ExternalLoader.
class MetaStoreJSONConfigRepository : public IExternalLoaderConfigRepository
{
public:
MetaStoreJSONConfigRepository(const std::shared_ptr<MetaStoreDispatcher> & metastore_dispatcher_, const std::string & namespace_);
std::string getName() const override { return name; }
/// Return set of function names from metastore
std::set<std::string> getAllLoadablesDefinitionNames() override;
/// Checks that file with name exists on metastore
bool exists(const std::string & definition_entity_name) override;
Poco::Timestamp getUpdateTime(const std::string & definition_entity_name) override;
LoadablesConfigurationPtr load(const std::string & key) override;
Poco::JSON::Object::Ptr get(const std::string & key) const;
Poco::JSON::Object::Ptr readConfigKey(const std::string & key) const;
void save(const std::string & key, const Poco::JSON::Object::Ptr & config);
void remove(const std::string & config_file);
Poco::JSON::Array::Ptr list() const;
/// Get the version of config key
uint32_t getVersion(const std::string & definition_entity_name);
private:
std::shared_ptr<MetaStoreDispatcher> metastore_dispatcher;
const std::string name;
const std::string ns;
const std::string main_config_path;
};
}
}