-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLsmTree.h
More file actions
40 lines (36 loc) · 1.02 KB
/
LsmTree.h
File metadata and controls
40 lines (36 loc) · 1.02 KB
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
#ifndef LSMTREE_LSMTREE_H
#define LSMTREE_LSMTREE_H
#include <string>
#include "BloomFilter.h"
#include "SortetStringTable.h"
#include <map>
#include <set>
class LsmTree {
public:
LsmTree() {
bloomFilter = new BloomFilter();
sortetStringTable = new SortetStringTable(*bloomFilter);
dataMemoryUsed = 0;
srand(time(nullptr));
logFile.open("../log", std::ios_base::out);
}
~LsmTree() {
sortetStringTable -> update(data, updates, deleted);
delete bloomFilter;
delete sortetStringTable;
logFile.close();
}
std::string insert(std::string &value);
std::string get(std::string &key);
void update(std::string &key, std::string &value);
void erase(std::string &key);
private:
BloomFilter* bloomFilter;
SortetStringTable* sortetStringTable;
std::string getNewKey();
std::map<std::string, std::string> data, updates;
std::set<std::string> deleted;
std::ofstream logFile;
int dataMemoryUsed;
};
#endif //LSMTREE_LSMTREE_H