9160b1ab7b3f4e293d16d941dc745ae1f69f30b9
[ric-plt/sdl.git] / include / private / redis / hiredisclustersystem.hpp
1 /*
2    Copyright (c) 2018-2019 Nokia.
3
4    Licensed under the Apache License, Version 2.0 (the "License");
5    you may not use this file except in compliance with the License.
6    You may obtain a copy of the License at
7
8        http://www.apache.org/licenses/LICENSE-2.0
9
10    Unless required by applicable law or agreed to in writing, software
11    distributed under the License is distributed on an "AS IS" BASIS,
12    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    See the License for the specific language governing permissions and
14    limitations under the License.
15 */
16
17 #ifndef SHAREDDATALAYER_REDIS_HIREDISCLUSTERSYSTEM_HPP_
18 #define SHAREDDATALAYER_REDIS_HIREDISCLUSTERSYSTEM_HPP_
19
20 #include <hircluster.h>
21
22 namespace shareddatalayer
23 {
24     namespace redis
25     {
26         class HiredisClusterSystem
27         {
28         public:
29             HiredisClusterSystem() = default;
30
31             HiredisClusterSystem(const HiredisClusterSystem&) = delete;
32
33             HiredisClusterSystem& operator = (const HiredisClusterSystem&) = delete;
34
35             virtual ~HiredisClusterSystem() = default;
36
37             virtual redisClusterAsyncContext* redisClusterAsyncConnect(const char* addrs, int flags);
38
39             virtual int redisClusterAsyncSetConnectCallback(redisClusterAsyncContext* acc,
40                                                             redisClusterInstanceConnectCallback* fn);
41
42             virtual int redisClusterAsyncSetDisconnectCallback(redisClusterAsyncContext* acc,
43                                                                redisClusterInstanceDisconnectCallback* fn);
44
45             virtual int redisClusterAsyncCommandArgv(redisClusterAsyncContext* acc, redisClusterCallbackFn* fn,
46                                                      void* privdata, int argc, const char** argv,
47                                                      const size_t* argvlen);
48
49             virtual int redisClusterAsyncCommandArgvWithKey(redisClusterAsyncContext* acc, redisClusterCallbackFn* fn,
50                                                             void* privdata, const char* key, int keylen, int argc,
51                                                             const char** argv, const size_t* argvlen);
52
53             virtual void redisAsyncHandleRead(redisAsyncContext* ac);
54
55             virtual void redisAsyncHandleWrite(redisAsyncContext* ac);
56
57             virtual void redisClusterAsyncDisconnect(redisClusterAsyncContext* acc);
58
59             virtual void redisClusterAsyncFree(redisClusterAsyncContext* acc);
60
61             static HiredisClusterSystem& getInstance();
62         };
63     }
64 }
65
66 #endif