]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | ||
4 | #ifndef CEPH_OS_BLUESTORE_FREELISTMANAGER_H | |
5 | #define CEPH_OS_BLUESTORE_FREELISTMANAGER_H | |
6 | ||
7 | #include <string> | |
8 | #include <map> | |
9 | #include <mutex> | |
10 | #include <ostream> | |
11 | #include "kv/KeyValueDB.h" | |
12 | ||
13 | class FreelistManager { | |
14 | public: | |
15 | CephContext* cct; | |
16 | FreelistManager(CephContext* cct) : cct(cct) {} | |
17 | virtual ~FreelistManager() {} | |
18 | ||
19 | static FreelistManager *create( | |
20 | CephContext* cct, | |
21 | string type, | |
7c673cae FG |
22 | string prefix); |
23 | ||
24 | static void setup_merge_operators(KeyValueDB *db); | |
25 | ||
b32b8144 | 26 | virtual int create(uint64_t size, uint64_t granularity, |
3efd9988 | 27 | KeyValueDB::Transaction txn) = 0; |
7c673cae | 28 | |
11fdf7f2 TL |
29 | virtual int expand(uint64_t new_size, |
30 | KeyValueDB::Transaction txn) = 0; | |
31 | ||
32 | virtual int init(KeyValueDB *kvdb) = 0; | |
7c673cae FG |
33 | virtual void shutdown() = 0; |
34 | ||
11fdf7f2 | 35 | virtual void dump(KeyValueDB *kvdb) = 0; |
7c673cae FG |
36 | |
37 | virtual void enumerate_reset() = 0; | |
11fdf7f2 | 38 | virtual bool enumerate_next(KeyValueDB *kvdb, uint64_t *offset, uint64_t *length) = 0; |
7c673cae FG |
39 | |
40 | virtual void allocate( | |
41 | uint64_t offset, uint64_t length, | |
42 | KeyValueDB::Transaction txn) = 0; | |
43 | virtual void release( | |
44 | uint64_t offset, uint64_t length, | |
45 | KeyValueDB::Transaction txn) = 0; | |
b32b8144 | 46 | |
11fdf7f2 | 47 | virtual uint64_t get_size() const = 0; |
b32b8144 FG |
48 | virtual uint64_t get_alloc_units() const = 0; |
49 | virtual uint64_t get_alloc_size() const = 0; | |
50 | ||
7c673cae FG |
51 | }; |
52 | ||
53 | ||
54 | #endif |