]>
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, | |
22 | KeyValueDB *db, | |
23 | string prefix); | |
24 | ||
25 | static void setup_merge_operators(KeyValueDB *db); | |
26 | ||
3efd9988 FG |
27 | virtual int create(uint64_t size, uint64_t min_alloc_size, |
28 | KeyValueDB::Transaction txn) = 0; | |
7c673cae | 29 | |
3efd9988 | 30 | virtual int init(uint64_t dev_size) = 0; |
7c673cae FG |
31 | virtual void shutdown() = 0; |
32 | ||
33 | virtual void dump() = 0; | |
34 | ||
35 | virtual void enumerate_reset() = 0; | |
36 | virtual bool enumerate_next(uint64_t *offset, uint64_t *length) = 0; | |
37 | ||
38 | virtual void allocate( | |
39 | uint64_t offset, uint64_t length, | |
40 | KeyValueDB::Transaction txn) = 0; | |
41 | virtual void release( | |
42 | uint64_t offset, uint64_t length, | |
43 | KeyValueDB::Transaction txn) = 0; | |
44 | }; | |
45 | ||
46 | ||
47 | #endif |