Skip to content
Redis_Provider.h 987 B
Newer Older
Valerio Pastore's avatar
Valerio Pastore committed
/*
 *
 *  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:
Valerio Pastore's avatar
Valerio Pastore committed
	std::shared_ptr<std::iostream> stream;
Valerio Pastore's avatar
Valerio Pastore committed
	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();
Valerio Pastore's avatar
Valerio Pastore committed
	RedisProvider(std::string ip, int port, std::string key);
Valerio Pastore's avatar
Valerio Pastore committed

	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;}
Valerio Pastore's avatar
Valerio Pastore committed
	std::string getKey(){return this->key;}
Valerio Pastore's avatar
Valerio Pastore committed


	int write(BasePacket &);
	int write(BasePacket &, std::string dest);
	int close();
	int open();
Valerio Pastore's avatar
Valerio Pastore committed
	~RedisProvider();
Valerio Pastore's avatar
Valerio Pastore committed

};

#endif /* REDISPROVIDER_H_ */