]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | ||
4 | #include "node_extent_manager.h" | |
5 | ||
6 | #include "node_extent_manager/dummy.h" | |
7 | #include "node_extent_manager/seastore.h" | |
8 | #include "stages/node_stage_layout.h" | |
9 | ||
10 | namespace crimson::os::seastore::onode { | |
11 | ||
12 | std::pair<node_type_t, field_type_t> NodeExtent::get_types() const { | |
13 | const auto header = reinterpret_cast<const node_header_t*>(get_read()); | |
14 | auto node_type = header->get_node_type(); | |
15 | auto field_type = header->get_field_type(); | |
16 | if (!field_type.has_value()) { | |
17 | throw std::runtime_error("load failed: bad field type"); | |
18 | } | |
19 | return {node_type, *field_type}; | |
20 | } | |
21 | ||
22 | NodeExtentManagerURef NodeExtentManager::create_dummy(bool is_sync) { | |
23 | if (is_sync) { | |
24 | return NodeExtentManagerURef(new DummyNodeExtentManager<true>()); | |
25 | } else { | |
26 | return NodeExtentManagerURef(new DummyNodeExtentManager<false>()); | |
27 | } | |
28 | } | |
29 | ||
30 | NodeExtentManagerURef NodeExtentManager::create_seastore( | |
31 | TransactionManager& tm, laddr_t min_laddr) { | |
32 | return NodeExtentManagerURef(new SeastoreNodeExtentManager(tm, min_laddr)); | |
33 | } | |
34 | ||
35 | } |