-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsstable.h
65 lines (62 loc) · 1.35 KB
/
sstable.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
65
#ifndef SSTABLE_H
#define SSTABLE_H
#include <string>
#include <vector>
#include <fstream>
#include "memtable.h"
#include "bloomfilter.h"
class sstable
{
private:
std::pair<uint64_t, uint32_t> *index;
std::string *data;
struct Header{
uint64_t time;
uint64_t num;
uint64_t min;
uint64_t max;
};
public:
explicit sstable(std::vector<memTable::dataNode> &vec);
~sstable();
uint32_t get(uint64_t key);
void reset();
bool check(uint64_t key);
void setTime(uint64_t time){
header.time = time;
}
void setNum(uint64_t num){
header.num = num;
}
void setMax(uint64_t max){
header.max = max;
}
void setMin(uint64_t min){
header.min = min;
}
uint64_t getTime(){
return header.time;
}
uint64_t getNum(){
return header.num;
}
uint64_t getMax(){
return header.max;
}
uint64_t getMin(){
return header.min;
}
void makeFileSST(std::string path);
void getIndex(std::pair<uint64_t, uint32_t> *newindex){
for(uint64_t i = 0; i < header.num; i++){
newindex[i].first = index[i].first;
newindex[i].second = index[i].second;
}
}
void getBf(BloomFilter *newbf){
bf.getBf(newbf);
}
Header header{};
BloomFilter bf;
};
#endif // SSTABLE_H