]> git.proxmox.com Git - ceph.git/blob - ceph/src/crimson/os/seastore/collection_manager.h
update ceph source to reef 18.2.1
[ceph.git] / ceph / src / crimson / os / seastore / collection_manager.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #pragma once
5
6 #include <seastar/core/future.hh>
7
8 #include "osd/osd_types.h"
9
10 #include "crimson/os/seastore/seastore_types.h"
11 #include "crimson/os/seastore/transaction_manager.h"
12
13 namespace crimson::os::seastore {
14
15 struct coll_info_t {
16 unsigned split_bits;
17
18 coll_info_t(unsigned bits)
19 : split_bits(bits) {}
20
21 bool operator==(const coll_info_t &rhs) const {
22 return split_bits == rhs.split_bits;
23 }
24 };
25
26 /// Interface for maintaining set of collections
27 class CollectionManager {
28 public:
29 using base_iertr = TransactionManager::read_extent_iertr;
30
31 /// Initialize collection manager instance for an empty store
32 using mkfs_iertr = TransactionManager::alloc_extent_iertr;
33 using mkfs_ret = mkfs_iertr::future<coll_root_t>;
34 virtual mkfs_ret mkfs(
35 Transaction &t) = 0;
36
37 /// Create collection
38 using create_iertr = base_iertr;
39 using create_ret = create_iertr::future<>;
40 virtual create_ret create(
41 coll_root_t &root,
42 Transaction &t,
43 coll_t cid,
44 coll_info_t info
45 ) = 0;
46
47 /// List collections with info
48 using list_iertr = base_iertr;
49 using list_ret_bare = std::vector<std::pair<coll_t, coll_info_t>>;
50 using list_ret = list_iertr::future<list_ret_bare>;
51 virtual list_ret list(
52 const coll_root_t &root,
53 Transaction &t) = 0;
54
55 /// Remove cid
56 using remove_iertr = base_iertr;
57 using remove_ret = remove_iertr::future<>;
58 virtual remove_ret remove(
59 const coll_root_t &coll_root,
60 Transaction &t,
61 coll_t cid) = 0;
62
63 /// Update info for cid
64 using update_iertr = base_iertr;
65 using update_ret = base_iertr::future<>;
66 virtual update_ret update(
67 const coll_root_t &coll_root,
68 Transaction &t,
69 coll_t cid,
70 coll_info_t info
71 ) = 0;
72
73 virtual ~CollectionManager() {}
74 };
75 using CollectionManagerRef = std::unique_ptr<CollectionManager>;
76
77 namespace collection_manager {
78 /* creat CollectionMapManager for Collection */
79 CollectionManagerRef create_coll_manager(
80 TransactionManager &trans_manager);
81
82 }
83
84 }