1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
8 #include "crimson/os/seastore/ordering_handle.h"
9 #include "crimson/os/seastore/seastore_types.h"
10 #include "crimson/os/seastore/segment_seq_allocator.h"
12 namespace crimson::os::seastore
{
14 namespace random_block_device
{
18 class SegmentManagerGroup
;
19 class SegmentProvider
;
24 virtual JournalTrimmer
&get_trimmer() = 0;
26 * initializes journal for mkfs writes -- must run prior to calls
29 using open_for_mkfs_ertr
= crimson::errorator
<
30 crimson::ct_error::input_output_error
32 using open_for_mkfs_ret
= open_for_mkfs_ertr::future
<journal_seq_t
>;
33 virtual open_for_mkfs_ret
open_for_mkfs() = 0;
36 * initializes journal for new writes -- must run prior to calls
37 * to submit_record. Should be called after replay if not a new
40 using open_for_mount_ertr
= open_for_mkfs_ertr
;
41 using open_for_mount_ret
= open_for_mkfs_ret
;
42 virtual open_for_mount_ret
open_for_mount() = 0;
45 using close_ertr
= crimson::errorator
<
46 crimson::ct_error::input_output_error
>;
47 virtual close_ertr::future
<> close() = 0;
52 * write record with the ordering handle
54 using submit_record_ertr
= crimson::errorator
<
55 crimson::ct_error::erange
,
56 crimson::ct_error::input_output_error
58 using submit_record_ret
= submit_record_ertr::future
<
61 virtual submit_record_ret
submit_record(
63 OrderingHandle
&handle
69 * Wait for all outstanding IOs on handle to commit.
70 * Note, flush() machinery must go through the same pipeline
71 * stages and locks as submit_record.
73 virtual seastar::future
<> flush(OrderingHandle
&handle
) = 0;
75 /// sets write pipeline reference
76 virtual void set_write_pipeline(WritePipeline
*_write_pipeline
) = 0;
79 * Read deltas and pass to delta_handler
81 * record_block_start (argument to delta_handler) is the start of the
82 * of the first block in the record
84 using replay_ertr
= crimson::errorator
<
85 crimson::ct_error::input_output_error
,
86 crimson::ct_error::invarg
,
87 crimson::ct_error::enoent
,
88 crimson::ct_error::erange
>;
89 using replay_ret
= replay_ertr::future
<>;
90 using delta_handler_t
= std::function
<
91 replay_ertr::future
<bool>(
92 const record_locator_t
&,
94 const journal_seq_t
&, // dirty_tail
95 const journal_seq_t
&, // alloc_tail
96 sea_time_point modify_time
)>;
97 virtual replay_ret
replay(
98 delta_handler_t
&&delta_handler
) = 0;
100 virtual seastar::future
<> finish_commit(
101 transaction_type_t type
) = 0;
103 virtual ~Journal() {}
105 virtual journal_type_t
get_type() = 0;
107 using JournalRef
= std::unique_ptr
<Journal
>;
111 JournalRef
make_segmented(
112 SegmentProvider
&provider
,
113 JournalTrimmer
&trimmer
);
115 JournalRef
make_circularbounded(
116 JournalTrimmer
&trimmer
,
117 crimson::os::seastore::random_block_device::RBMDevice
* device
,