-
Notifications
You must be signed in to change notification settings - Fork 7
/
rocksdb_impl.h
59 lines (44 loc) · 1.26 KB
/
rocksdb_impl.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
#pragma once
#include "leveldb.h"
#include <pthread.h>
namespace rocksdb {
// For forward declaration.
class DB;
class Options;
}
// An interface to the RocksDB implementation
class RocksDBImpl {
friend class RocksDBSequentialFile;
friend class RocksDBRandomAccessFile;
friend class RocksDBWritableFile;
friend class RocksDBDirectory;
friend class RocksDBEnv;
public:
RocksDBImpl(const LevelDBParams& params, std::vector<Stat>& stats);
~RocksDBImpl();
// Prints the summary of the store.
void print_status() const;
// Writes the current items in the store to the file.
void dump_state(FILE* fp) const;
// Puts a new item in the store.
void put(LevelDBKey key, uint32_t item_size);
// Deletes an item from the store.
void del(LevelDBKey key);
// Gets an item from the store.
uint64_t get(LevelDBKey key);
// Forces compaction until there is no SSTable except the last level.
void force_compact();
protected:
void Read(std::size_t len);
void Append(std::size_t len);
void Delete(std::size_t len);
private:
LevelDBParams params_;
std::vector<Stat>& stats_;
rocksdb::Options* options_;
rocksdb::DB* db_;
pthread_mutex_t stats_mutex_;
volatile uint64_t read_;
volatile uint64_t appended_;
char value_buf_[1024];
};