-
Notifications
You must be signed in to change notification settings - Fork 2
/
database.h
64 lines (55 loc) · 1.34 KB
/
database.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include "config.h"
#include "log.h"
#ifdef REDIS_FOUND
#include "redis.h"
#endif
#ifdef VOLDEMORT_FOUND
#include "voldemort.h"
#endif
#ifdef BDB_FOUND
#include "bdb.h"
#endif
using namespace std;
#define VOLDEMORT 1
#define REDIS 2
#define BDB 3
#define DATABASE REDIS
#define BILLION 1E9
#ifdef APPLE
#include <sys/statvfs.h>
#include <sys/dir.h>
#define CLOCK_REALTIME 1
#endif
extern struct timespec start, stop;
extern double time_spent;
extern int vold_calls;
extern int readdir_calls;
extern int access_calls;
extern int getattr_calls;
extern int read_calls;
extern int write_calls;
extern int create_calls;
extern int rename_calls;
extern double tot_time;
extern double vold_avg_time;
extern double readdir_avg_time;
extern double access_avg_time;
extern double getattr_avg_time;
extern double read_avg_time;
extern double write_avg_time;
extern double create_avg_time;
extern double rename_avg_time;
extern double localize_time;
extern int redis_calls;
extern double redis_avg_time;
extern int bdb_calls;
extern double bdb_avg_time;
bool init_database();
string database_setval(string file_id, string col, string val);
string database_getval(string col, string val);
string database_getvals(string col);
void database_remove_val(string file, string col, string val);