Skip to content

Commit 5951c65

Browse files
authored
Make read and write messages contiguous (#1387)
The `BlockIO` trait only allows us to access contiguous sets of blocks for reading and writing. However, our internal `Message` type converts these contiguous spans into random-access block lists. This adds complexity: we have to support the possibility for disjoint operations everywhere, even though they should never actually happen. This PR changes the `Message` types to accept a starting index + block count (for reads), or a starting index + block and context data (for writes). In addition, the `ReadResponse` is simplified to not include per-block indexes, because they're implied by the start index + position in the list. Various tests for disjoint reads and writes are removed.
1 parent 58dfca4 commit 5951c65

File tree

12 files changed

+512
-990
lines changed

12 files changed

+512
-990
lines changed

common/src/impacted_blocks.rs

+8
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,14 @@ impl ImpactedBlocks {
129129
ImpactedBlocks::Empty
130130
}
131131

132+
/// Returns the first impacted address
133+
pub fn start(&self) -> Option<ImpactedAddr> {
134+
match self {
135+
ImpactedBlocks::InclusiveRange(a, _) => Some(*a),
136+
ImpactedBlocks::Empty => None,
137+
}
138+
}
139+
132140
/// Create a new ImpactedBlocks range starting at a given offset, and
133141
/// stretching n_blocks further into the extent. Panics an error if
134142
/// `extent_size` is 0. Returns ImpactedBlocks::Empty if n_blocks is 0.

0 commit comments

Comments
 (0)