Add extra line about src files are part of RIC platform project
[ric-plt/sdl.git] / include / private / redis / hiredissystem.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 /*
18  * This source code is part of the near-RT RIC (RAN Intelligent Controller)
19  * platform project (RICP).
20 */
21
22 #ifndef SHAREDDATALAYER_REDIS_HIREDISSYSTEM_HPP_
23 #define SHAREDDATALAYER_REDIS_HIREDISSYSTEM_HPP_
24
25 #include <hiredis/hiredis.h>
26 #include <async.h>
27
28 namespace shareddatalayer
29 {
30     namespace redis
31     {
32         class HiredisSystem
33         {
34         public:
35             HiredisSystem() = default;
36
37             HiredisSystem(const HiredisSystem&) = delete;
38
39             HiredisSystem& operator = (const HiredisSystem&) = delete;
40
41             virtual ~HiredisSystem() = default;
42
43             virtual redisContext* redisConnect(const char* ip, int port);
44
45             virtual void* redisCommandArgv(redisContext* context, int argc, const char** argv, const size_t* argvlen);
46
47             virtual void freeReplyObject(void* reply);
48
49             virtual void redisFree(redisContext* context);
50
51             virtual redisAsyncContext* redisAsyncConnect(const char* ip, int port);
52
53             virtual int redisAsyncSetConnectCallback(redisAsyncContext* ac, redisConnectCallback* fn);
54
55             virtual int redisAsyncSetDisconnectCallback(redisAsyncContext* ac, redisDisconnectCallback* fn);
56
57             virtual int redisAsyncCommandArgv(redisAsyncContext* ac,
58                                               redisCallbackFn* fn,
59                                               void* privdata,
60                                               int argc,
61                                               const char** argv,
62                                               const size_t* argvlen);
63
64             virtual void redisAsyncHandleRead(redisAsyncContext* ac);
65
66             virtual void redisAsyncHandleWrite(redisAsyncContext* ac);
67
68             virtual void redisAsyncDisconnect(redisAsyncContext* ac);
69
70             virtual void redisAsyncFree(redisAsyncContext* ac);
71
72             static HiredisSystem& getHiredisSystem() noexcept;
73         };
74     }
75 }
76
77 #endif