InfinispanHotRodC++Client  8.2.0.Alpha1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
RemoteCacheBase.h
Go to the documentation of this file.
1 #ifndef ISPN_HOTROD_REMOTECACHEBASE_H
2 #define ISPN_HOTROD_REMOTECACHEBASE_H
3 
4 
5 
12 #include <map>
13 #include <set>
14 #include <vector>
15 
16 using namespace org::infinispan::query::remote::client;
17 using namespace infinispan::hotrod::event;
18 
19 namespace infinispan {
20 namespace hotrod {
21 
22 namespace operations {
23 class OperationsFactory;
24 }
25 
26 namespace event {
27 template <class K, class V> class CacheClientListener;
28 }
29 typedef void (*MarshallHelperFn) (void*, const void*, std::vector<char> &);
30 typedef void* (*UnmarshallHelperFn) (void*, const std::vector<char> &);
31 
32 class KeyUnmarshallerFtor;
33 class ValueUnmarshallerFtor;
34 class RemoteCacheImpl;
35 
37 {
38 public:
39  virtual ~RemoteCacheBase() {}
40 protected:
41  HR_EXTERN const char *base_getName();
42  HR_EXTERN void *base_get(const void *key);
43  HR_EXTERN void *base_put(const void *key, const void *value, int64_t life, int64_t idle);
44  HR_EXTERN void *base_putIfAbsent(const void *key, const void *value, int64_t life, int64_t idle);
45  HR_EXTERN void *base_replace(const void *key, const void *value, int64_t life, int64_t idle);
46  HR_EXTERN void *base_remove(const void *key);
47  HR_EXTERN bool base_containsKey(const void *key);
48  HR_EXTERN void base_ping();
49  HR_EXTERN bool base_replaceWithVersion(const void *key, const void *value, int64_t version, int64_t life, int64_t idle);
50  HR_EXTERN bool base_removeWithVersion(const void *key, int64_t version);
51  HR_EXTERN void *base_getWithVersion(const void* key, VersionedValue* version);
52  HR_EXTERN void *base_getWithMetadata(const void* key, MetadataValue* metadata);
53  HR_EXTERN void base_getBulk(int size, std::map<void*, void*> &mbuf);
54  HR_EXTERN void base_keySet(int scope, std::vector<void*> &sbuf);
55  HR_EXTERN void base_stats(std::map<std::string,std::string> &sbuf);
56  HR_EXTERN void base_clear();
57  HR_EXTERN uint64_t base_size();
58  HR_EXTERN void base_withFlags(Flag flag);
59  HR_EXTERN std::vector<unsigned char> base_execute(const std::string &cmdName, const std::map<std::string,std::string>& args);
60  HR_EXTERN CacheTopologyInfo base_getCacheTopologyInfo();
61  HR_EXTERN QueryResponse base_query(const QueryRequest &qr);
62  HR_EXTERN std::vector<unsigned char> base_query_char(std::vector<unsigned char> qr, size_t size);
63 
64  HR_EXTERN void base_addClientListener(ClientListener &clientListener, const std::vector<std::vector<char> > filterFactoryParam, const std::vector<std::vector<char> > converterFactoryParams, const std::function<void()> &recoveryCallback);
65  HR_EXTERN void base_removeClientListener(ClientListener &clientListener);
66 
68  HR_EXTERN void setMarshallers(void* rc, MarshallHelperFn kf, MarshallHelperFn vf, UnmarshallHelperFn ukf, UnmarshallHelperFn uvf);
69 private:
70  std::shared_ptr<RemoteCacheImpl> impl; // pointer to RemoteCacheImpl;
71  void *remoteCachePtr=nullptr; // TODO: pointer to self, is it really necessary?
72  MarshallHelperFn baseKeyMarshallFn;
73  MarshallHelperFn baseValueMarshallFn;
74  HR_EXTERN void baseKeyMarshall(const void* k, std::vector<char> &buf);
75  HR_EXTERN void baseValueMarshall(const void* v, std::vector<char> &buf);
76 
77  UnmarshallHelperFn baseKeyUnmarshallFn;
78  UnmarshallHelperFn baseValueUnmarshallFn;
79  HR_EXTERN void* baseKeyUnmarshall(const std::vector<char> &buf);
80  HR_EXTERN void* baseValueUnmarshall(const std::vector<char> &buf);
81 
82 friend class RemoteCacheManager;
83 friend class RemoteCacheImpl;
84 friend class NearRemoteCacheImpl;
85 friend class KeyUnmarshallerFtor;
86 friend class ValueUnmarshallerFtor;
87 template <class K, class V>
88 friend class ::infinispan::hotrod::event::CacheClientListener;
89 };
90 
91 }} // namespace
92 
93 #endif /* ISPN_HOTROD_REMOTECACHEBASE_H */
void(* MarshallHelperFn)(void *, const void *, std::vector< char > &)
Definition: RemoteCacheBase.h:29
#define HR_EXTERN
Definition: ImportExport.h:35
Definition: CacheTopologyInfo.h:10
virtual ~RemoteCacheBase()
Definition: RemoteCacheBase.h:39
Definition: RemoteCacheManager.h:38
Definition: ClientListener.h:35
void *(* UnmarshallHelperFn)(void *, const std::vector< char > &)
Definition: RemoteCacheBase.h:30
RemoteCacheBase()
Definition: RemoteCacheBase.h:67
Definition: CacheClientListener.h:33
Definition: RemoteCacheBase.h:36
Definition: MetadataValue.h:9
Flag
Definition: Flag.h:7
Definition: VersionedValue.h:9