-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhrocksdb.h
More file actions
60 lines (50 loc) · 1.76 KB
/
hrocksdb.h
File metadata and controls
60 lines (50 loc) · 1.76 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once
#include "batch.h"
#include "config.h"
#include "debugger.h"
#include <rocksdb/db.h>
#include "gmemtable.h"
#include "db_timer.h"
#include "rocksdb_ops.h"
#include <chrono>
class HRocksDB {
public:
HRocksDB(Config config);
~HRocksDB();
void Get(const std::string& key);
void Put(const std::string& key, const std::string& value);
void Delete(const std::string& key);
void Range(const std::string& startKey, const std::string& endKey);
void Merge(const std::string& key);
void Close();
void HOpen(std::string fileLocation);
void Delete(std::string fileLocation);
void executeOnCPU(OperationType type, std::string key, std::string value);
uint64_t computeRequestRate(Batch* batch);
void updateBatchSize();
void updateBatchSizeFromSample(uint64_t ops_in_batch, uint64_t elapsed_us);
GMemtable** activeTable = nullptr;
GMemtable** immutableTables = nullptr;
DbTimer* timer = nullptr;
std::string path;
Batch* currentBatch = nullptr;
int keyLength = 0;
int valueLength = 0;
int batchID = -1;
void batchLimitReached();
Config config;
Debugger debug;
rocksdb::DB* rdb = nullptr;
uint64_t opID;
std::string fileLocation;
RocksDBOperations* rdbOps = nullptr;
std::unordered_map<int, int> memtableBatchMap;
unsigned int previousRequestRate;
unsigned long long int currentBatchSize;
int numMemtablesAcrossBatches;
bool executingOnCPU;
std::chrono::high_resolution_clock::time_point lastBatchTimeStamp; // Ensure correct type
std::chrono::high_resolution_clock::time_point currentTimeStamp;
uint64_t maxBatchCap = 0; // dynamic cap that grows/shrinks
uint64_t currentRequestRate = 0; // ops/sec
};