00001 #ifndef ISPN_HOTROD_REMOTECACHEBASE_H
00002 #define ISPN_HOTROD_REMOTECACHEBASE_H
00003
00004
00005
00006 #include "infinispan/hotrod/ImportExport.h"
00007 #include "infinispan/hotrod/Handle.h"
00008 #include "infinispan/hotrod/Flag.h"
00009 #include "infinispan/hotrod/MetadataValue.h"
00010
00011 #include <map>
00012 #include <set>
00013
00014 namespace infinispan {
00015 namespace hotrod {
00016
00017 namespace operations {
00018 class OperationsFactory;
00019 }
00020
00021 class RemoteCacheImpl;
00022 class RemoteCacheManagerImpl;
00023
00024 typedef void (*MarshallHelperFn) (void*, const void*, void*);
00025 typedef void* (*UnmarshallHelperFn) (void*, const void*);
00026
00027 class HR_EXTERN RemoteCacheBase
00028 : public infinispan::hotrod::Handle<RemoteCacheImpl>
00029 {
00030 public:
00031 const std::string& base_getName();
00032 void base_get(const void *key, void *rbuf);
00033 void base_put(const void *key, const void *value, int64_t life, int64_t idle, void *buf);
00034 void base_putIfAbsent(const void *key, const void *value, int64_t life, int64_t idle, void *buf);
00035 void base_replace(const void *key, const void *value, int64_t life, int64_t idle, void *buf);
00036 void base_remove(const void *key, void *rbuf);
00037 void base_containsKey(const void *key, bool *res);
00038 void base_ping();
00039 void base_replaceWithVersion(const void *key, const void *value, int64_t version, int64_t life, int64_t idle, bool *res);
00040 void base_removeWithVersion(const void *key, int64_t version, bool *res);
00041 void base_getWithVersion(const void* key, void* vbuf, VersionedValue* version);
00042 void base_getWithMetadata(const void* key, void* vbuf, MetadataValue* metadata);
00043 void base_getBulk(int size, std::map<void*, void*>* mbuf);
00044 void base_keySet(int scope, std::set<void*>* sbuf);
00045 void base_stats(std::map<std::string,std::string>* sbuf);
00046 void base_clear();
00047 void base_withFlags(Flag flag);
00048
00049 void init(operations::OperationsFactory* operationFactory);
00050
00051 protected:
00052 RemoteCacheBase();
00053 void setMarshallers(void* rc, MarshallHelperFn kf, MarshallHelperFn vf, UnmarshallHelperFn ukf, UnmarshallHelperFn uvf);
00054
00055 private:
00056 void *remoteCachePtr;
00057 MarshallHelperFn baseKeyMarshallFn;
00058 MarshallHelperFn baseValueMarshallFn;
00059 void baseKeyMarshall(const void* k, void *buf);
00060 void baseValueMarshall(const void* v, void *buf);
00061
00062 UnmarshallHelperFn baseKeyUnmarshallFn;
00063 UnmarshallHelperFn baseValueUnmarshallFn;
00064 void* baseKeyUnmarshall(const void* buf);
00065 void* baseValueUnmarshall(const void* buf);
00066
00067 friend class RemoteCacheManager;
00068 friend class RemoteCacheImpl;
00069 };
00070
00071 }}
00072
00073 #endif