Rolf Badorek | ef2bf51 | 2019-08-20 11:17:15 +0300 | [diff] [blame^] | 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 | #include "private/redis/hiredissystem.hpp" |
| 18 | |
| 19 | using namespace shareddatalayer::redis; |
| 20 | |
| 21 | redisContext* HiredisSystem::redisConnect(const char* ip, int port) |
| 22 | { |
| 23 | return ::redisConnect(ip, port); |
| 24 | } |
| 25 | |
| 26 | void* HiredisSystem::redisCommandArgv(redisContext* context, int argc, const char** argv, const size_t* argvlen) |
| 27 | { |
| 28 | return ::redisCommandArgv(context, argc, argv, argvlen); |
| 29 | } |
| 30 | |
| 31 | void HiredisSystem::freeReplyObject(void* reply) |
| 32 | { |
| 33 | ::freeReplyObject(reply); |
| 34 | } |
| 35 | |
| 36 | void HiredisSystem::redisFree(redisContext* context) |
| 37 | { |
| 38 | ::redisFree(context); |
| 39 | } |
| 40 | |
| 41 | redisAsyncContext* HiredisSystem::redisAsyncConnect(const char* ip, int port) |
| 42 | { |
| 43 | return ::redisAsyncConnect(ip, port); |
| 44 | } |
| 45 | |
| 46 | int HiredisSystem::redisAsyncSetConnectCallback(redisAsyncContext* ac, redisConnectCallback* fn) |
| 47 | { |
| 48 | return ::redisAsyncSetConnectCallback(ac, fn); |
| 49 | } |
| 50 | |
| 51 | int HiredisSystem::redisAsyncSetDisconnectCallback(redisAsyncContext* ac, redisDisconnectCallback* fn) |
| 52 | { |
| 53 | return ::redisAsyncSetDisconnectCallback(ac, fn); |
| 54 | } |
| 55 | |
| 56 | int HiredisSystem::redisAsyncCommandArgv(redisAsyncContext* ac, |
| 57 | redisCallbackFn* fn, |
| 58 | void* privdata, |
| 59 | int argc, |
| 60 | const char** argv, |
| 61 | const size_t* argvlen) |
| 62 | { |
| 63 | return ::redisAsyncCommandArgv(ac, fn, privdata, argc, argv, argvlen); |
| 64 | } |
| 65 | |
| 66 | void HiredisSystem::redisAsyncHandleRead(redisAsyncContext* ac) |
| 67 | { |
| 68 | ::redisAsyncHandleRead(ac); |
| 69 | } |
| 70 | |
| 71 | void HiredisSystem::redisAsyncHandleWrite(redisAsyncContext* ac) |
| 72 | { |
| 73 | ::redisAsyncHandleWrite(ac); |
| 74 | } |
| 75 | |
| 76 | void HiredisSystem::redisAsyncDisconnect(redisAsyncContext* ac) |
| 77 | { |
| 78 | ::redisAsyncDisconnect(ac); |
| 79 | } |
| 80 | |
| 81 | void HiredisSystem::redisAsyncFree(redisAsyncContext* ac) |
| 82 | { |
| 83 | ::redisAsyncFree(ac); |
| 84 | } |
| 85 | |
| 86 | HiredisSystem& HiredisSystem::getHiredisSystem() noexcept |
| 87 | { |
| 88 | static HiredisSystem hiredisSystem; |
| 89 | return hiredisSystem; |
| 90 | } |