-
Notifications
You must be signed in to change notification settings - Fork 0
/
BGPCassandraInserter.h
44 lines (34 loc) · 1.44 KB
/
BGPCassandraInserter.h
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
//
// Created by josqu on 25/06/2021.
//
#include <iostream>
#include <cassandra.h>
#ifndef BGPREDISSAVER_BGPCASSANDRAINSERTER_H
#define BGPREDISSAVER_BGPCASSANDRAINSERTER_H
class BGPCassandraInserter {
public:
//#################### METHODES PUBLIQUES ####################
BGPCassandraInserter();
BGPCassandraInserter(std::string host, int port, int batchMaxSize);
void init_connections();
void end_connections();
int insert(std::string dstTable, std::string set_name, std::string old_key, std::string old_value, unsigned int old_timestamp);
void setCassandra(std::string cassandra_host, int cassandra_port);
void setBatchMaxSize(int max_size);
private:
//#################### ATTRIBUTS PRIVES ####################
CassCluster *cluster;
CassSession *session;
CassBatch *batch;
int batch_size;
int BATCH_MAX_SIZE = 1000;
std::string cassandra_host="127.0.0.1";
int cassandra_port=9042;
const char *KEYSPACE="BGP_KEYSPACE";
//#################### METHODES PRIVEES ####################
CassStatement *addRoutingEventQuery(std::string old_key, std::string old_value);
CassStatement *addASEventQuery(std::string old_key, std::string old_value);
CassStatement *addPathQuery(std::string old_value);
CassStatement *addDefaultQuery(std::string dstTable, std::string set_name, std::string old_key, std::string old_value, unsigned int old_timestamp);
};
#endif //BGPREDISSAVER_BGPCASSANDRAINSERTER_H