Infinispan HotRod C++ Client 9.2.0.Final
Loading...
Searching...
No Matches
RemoteCacheManagerAdmin.h
Go to the documentation of this file.
1/*
2 * RemoteCacheManagerAdmin.h
3 *
4 * Created on: Apr 10, 2018
5 * Author: rigazilla
6 */
7
8#ifndef INCLUDE_INFINISPAN_HOTROD_REMOTECACHEMANAGERADMIN_H_
9#define INCLUDE_INFINISPAN_HOTROD_REMOTECACHEMANAGERADMIN_H_
10
14#include <vector>
15#include <set>
16
17namespace infinispan {
18namespace hotrod {
19namespace transport {
20class TransportFactory;
21}
22
23namespace operations {
24class OperationsFactory;
25}
26
27namespace protocol {
28class Codec;
29}
30
31using namespace transport;
32using namespace operations;
33using namespace protocol;
34
36 PERMANENT=0
37};
38
40public:
41 RemoteCacheManagerAdmin(RemoteCacheManager& cacheManager, std::function<void(std::string&)> remover, std::shared_ptr<OperationsFactory> of);
50 template <class K, class V> RemoteCache<K, V>& createCache(const std::string name, std::string model) {
51 createCache(name, model, "@@cache@create");
52 return cacheManager.getCache<K,V>(name);
53 }
54
62 template <class K, class V> RemoteCache<K, V>& createCacheWithXml(const std::string name, std::string conf) {
63 createCacheWithXml(name, conf, "@@cache@create");
64 return cacheManager.getCache<K,V>(name);
65
66 }
67
77 template <class K, class V> RemoteCache<K, V>& getOrCreateCache(const std::string name, std::string model) {
78 createCache(name, model, "@@cache@getorcreate");
79 return cacheManager.getCache<K,V>(name);
80 }
81
93 template <class K, class V> RemoteCache<K, V>& getOrCreateCacheWithXml(const std::string name, std::string conf) {
94 createCacheWithXml(name, conf, "@@cache@getorcreate");
95 return cacheManager.getCache<K,V>(name);
96 }
97
103 void removeCache(std::string name);
104
111 void reindexCache(std::string name);
112
116 std::set<std::string> getCacheNames();
117
118 RemoteCacheManagerAdmin& withFlags(std::set<AdminFlag> flags);
119 void createCache(const std::string name, std::string model, std::string command);
120 void createCacheWithXml(const std::string name, std::string conf, std::string command);
121
122private:
123 std::string flags2Params(const std::set<AdminFlag>& flags) const;
124
125 std::vector<char> executeAdminOperation(std::string adminCmd, std::map<std::string, std::string >& param);
126
127 static const std::vector<char> CACHE_NAME;
128 static const std::vector<char> CACHE_TEMPLATE;
129 static const std::vector<char> CACHE_CONFIGURATION;
130 static const std::vector<char> CACHE_FLAGS;
131 static const std::string FLAG_LABELS[];
132 std::shared_ptr<OperationsFactory> operationsFactory;
133 std::function<void(std::string&)> remover;
134
135 RemoteCacheManager& cacheManager;
136#ifdef SWIGJAVA // Swig needs public access to flags
137public:
138#endif
139 std::set<AdminFlag> flags;
140};
141
142}} // namespace infinispan::hotrod
143
144
145
146#endif /* INCLUDE_INFINISPAN_HOTROD_REMOTECACHEMANAGERADMIN_H_ */
#define HR_EXTERN
Definition: ImportExport.h:35
Definition: RemoteCacheManagerAdmin.h:39
RemoteCache< K, V > & createCacheWithXml(const std::string name, std::string conf)
Definition: RemoteCacheManagerAdmin.h:62
RemoteCache< K, V > & getOrCreateCache(const std::string name, std::string model)
Definition: RemoteCacheManagerAdmin.h:77
RemoteCache< K, V > & getOrCreateCacheWithXml(const std::string name, std::string conf)
Definition: RemoteCacheManagerAdmin.h:93
RemoteCacheManagerAdmin(RemoteCacheManager &cacheManager, std::function< void(std::string &)> remover, std::shared_ptr< OperationsFactory > of)
void createCacheWithXml(const std::string name, std::string conf, std::string command)
std::set< std::string > getCacheNames()
void createCache(const std::string name, std::string model, std::string command)
RemoteCache< K, V > & createCache(const std::string name, std::string model)
Definition: RemoteCacheManagerAdmin.h:50
RemoteCacheManagerAdmin & withFlags(std::set< AdminFlag > flags)
Definition: RemoteCacheManager.h:44
RemoteCache< K, V > & getCache(bool forceReturnValue)
Definition: RemoteCacheManager.h:114
Definition: RemoteCache.h:65
AdminFlag
Definition: RemoteCacheManagerAdmin.h:35
@ PERMANENT
Definition: RemoteCacheManagerAdmin.h:36
Definition: AuthenticationConfiguration.h:10