]> git.proxmox.com Git - ceph.git/blob - ceph/src/os/bluestore/FreelistManager.h
update sources to v12.2.3
[ceph.git] / ceph / src / os / bluestore / FreelistManager.h
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
27 virtual int create(uint64_t size, uint64_t granularity,
28 KeyValueDB::Transaction txn) = 0;
29
30 virtual int init(uint64_t dev_size) = 0;
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 virtual uint64_t get_alloc_units() const = 0;
46 virtual uint64_t get_alloc_size() const = 0;
47
48 };
49
50
51 #endif