-
Notifications
You must be signed in to change notification settings - Fork 0
/
kvstore_api.h
42 lines (35 loc) · 978 Bytes
/
kvstore_api.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
#pragma once
#include <cstdint>
#include <string>
#include <list>
class KVStoreAPI {
public:
/**
* You should put all sstables under `dir`.
* Please create one sub-directory for each level, and put sstables
* there. Please refer to the c++ filesystem library
* (https://en.cppreference.com/w/cpp/filesystem).
*/
KVStoreAPI(const std::string &dir) { }
KVStoreAPI() = delete;
/**
* Insert/Update the key-value pair.
* No return values for simplicity.
*/
virtual void put(uint64_t key, const std::string &s) = 0;
/**
* Returns the (string) value of the given key.
* An empty string indicates not found.
*/
virtual std::string get(uint64_t key) = 0;
/**
* Delete the given key-value pair if it exists.
* Returns false iff the key is not found.
*/
virtual bool del(uint64_t key) = 0;
/**
* This resets the kvstore. All key-value pairs should be removed,
* including memtable and all sstables files.
*/
virtual void reset() = 0;
};