Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
*
* Created on: Mar 1, 2021
* Author: astrisw
*/
#ifndef REDISPROVIDER_H_
#define REDISPROVIDER_H_
#include <Base_Provider.h>
#include <redis-cpp/stream.h>
#include <redis-cpp/execute.h>
#include <unordered_map>
class RedisProvider : public BaseProvider{
private:
rediscpp::stream *stream;
std::string ip;
std::string port;
std::string & key = *(&this->dest);
void setDest(std::string dest){setKey(dest);}
std::string getDest(){return getKey();}
public:
RedisProvider();
RedisProvider(std::string ip, int port);
void setIp(std::string ip){this->ip=ip;}
void setPort(std::string port){this->port=port;}
void setKey(std::string key){this->key=key;}
std::string getIp(){return this->ip;}
std::string getPort(){return this->port;}
std::string getkey(){return this->key;}
int write(BasePacket &);
int write(BasePacket &, std::string dest);
int close();
int open();
~RedisProvider(){
delete stream;
std::cout << "Deleting Redis stream" << std::endl;
}
};
#endif /* REDISPROVIDER_H_ */