1#pragma once
2
3#include <Access/MemoryAccessStorage.h>
4
5
6namespace Poco
7{
8 namespace Util
9 {
10 class AbstractConfiguration;
11 }
12}
13
14
15namespace DB
16{
17/// Implementation of IAccessStorage which loads all from users.xml periodically.
18class UsersConfigAccessStorage : public IAccessStorage
19{
20public:
21 UsersConfigAccessStorage();
22 ~UsersConfigAccessStorage() override;
23
24 void loadFromConfig(const Poco::Util::AbstractConfiguration & config);
25
26private:
27 std::optional<UUID> findImpl(std::type_index type, const String & name) const override;
28 std::vector<UUID> findAllImpl(std::type_index type) const override;
29 bool existsImpl(const UUID & id) const override;
30 AccessEntityPtr readImpl(const UUID & id) const override;
31 String readNameImpl(const UUID & id) const override;
32 UUID insertImpl(const AccessEntityPtr & entity, bool replace_if_exists) override;
33 void removeImpl(const UUID & id) override;
34 void updateImpl(const UUID & id, const UpdateFunc & update_func) override;
35 SubscriptionPtr subscribeForChangesImpl(const UUID & id, const OnChangedHandler & handler) const override;
36 SubscriptionPtr subscribeForChangesImpl(std::type_index type, const OnChangedHandler & handler) const override;
37 bool hasSubscriptionImpl(const UUID & id) const override;
38 bool hasSubscriptionImpl(std::type_index type) const override;
39
40 MemoryAccessStorage memory_storage;
41};
42}
43