]> git.proxmox.com Git - ceph.git/blame - ceph/src/os/bluestore/FreelistManager.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / os / bluestore / FreelistManager.h
CommitLineData
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>
1911f103 8#include <vector>
7c673cae
FG
9#include <mutex>
10#include <ostream>
11#include "kv/KeyValueDB.h"
1911f103 12#include "bluestore_types.h"
f67539c2 13#include "zoned_types.h"
7c673cae
FG
14
15class FreelistManager {
16public:
17 CephContext* cct;
18 FreelistManager(CephContext* cct) : cct(cct) {}
19 virtual ~FreelistManager() {}
20
21 static FreelistManager *create(
22 CephContext* cct,
f67539c2
TL
23 std::string type,
24 std::string prefix);
7c673cae 25
f67539c2 26 static void setup_merge_operators(KeyValueDB *db, const std::string &type);
7c673cae 27
b32b8144 28 virtual int create(uint64_t size, uint64_t granularity,
3efd9988 29 KeyValueDB::Transaction txn) = 0;
7c673cae 30
f67539c2
TL
31 virtual int init(KeyValueDB *kvdb, bool db_in_read_only,
32 std::function<int(const std::string&, std::string*)> cfg_reader) = 0;
1911f103 33 virtual void sync(KeyValueDB* kvdb) = 0;
7c673cae
FG
34 virtual void shutdown() = 0;
35
11fdf7f2 36 virtual void dump(KeyValueDB *kvdb) = 0;
7c673cae
FG
37
38 virtual void enumerate_reset() = 0;
11fdf7f2 39 virtual bool enumerate_next(KeyValueDB *kvdb, uint64_t *offset, uint64_t *length) = 0;
7c673cae
FG
40
41 virtual void allocate(
42 uint64_t offset, uint64_t length,
43 KeyValueDB::Transaction txn) = 0;
44 virtual void release(
45 uint64_t offset, uint64_t length,
46 KeyValueDB::Transaction txn) = 0;
b32b8144 47
11fdf7f2 48 virtual uint64_t get_size() const = 0;
b32b8144
FG
49 virtual uint64_t get_alloc_units() const = 0;
50 virtual uint64_t get_alloc_size() const = 0;
51
1911f103
TL
52 virtual void get_meta(uint64_t target_size,
53 std::vector<std::pair<string, string>>*) const = 0;
f67539c2
TL
54
55 virtual std::vector<zone_state_t> get_zone_states(KeyValueDB *kvdb) const {
56 return {};
57 }
7c673cae
FG
58};
59
60
61#endif