Newer
Older
RedisProvider::RedisProvider(std::string ip, int port, std::string key) {
int RedisProvider::write(PacketLib::BasePacket &packet) {
uint size = packet.getHeaderSize() + packet.getPayloadSize() + packet.getTailSize();
redisReply *r = (redisReply *) redisCommand(context, "LPUSH DAQ_key %b", (char*) packet.getBinaryPointer(), size);
std::cerr << "LPUSH command failed: " << r->str << std::endl;
int RedisProvider::write(PacketLib::BasePacket &packet, std::string key) {
uint size = packet.getHeaderSize() + packet.getPayloadSize() + packet.getTailSize();
redisReply *r = (redisReply *) redisCommand(context, "LPUSH %s %b", key, (char*) packet.getBinaryPointer(), size);
std::cerr << "LPUSH command failed: " << r->str << std::endl;
context = redisConnect(getIp().c_str(), getPort());
if (context == NULL || context->err) {
if (context) {
printf("Error: %s\n", context->errstr);
} else {
printf("Can't allocate Redis context\n");
RedisProvider::~RedisProvider(){
std::cout << "Deleting Redis stream" << std::endl;
}