-
Notifications
You must be signed in to change notification settings - Fork 6
Add an experimental mixed io mode. #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -1,7 +1,8 @@ | |||
use std::{io::Write, path::PathBuf}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt
@@ -1,3 +1,5 @@ | |||
use std::io; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt
@@ -1,3 +1,5 @@ | |||
use std::io; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt
use std::{fmt, io}; | ||
|
||
use crate::{ChunkNum, TreeNode}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt
use iroh_io::{AsyncStreamReader, AsyncStreamWriter}; | ||
use smallvec::SmallVec; | ||
|
||
pub use super::BaoContentItem; | ||
use super::{combine_hash_pair, DecodeError}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt
pub struct Leaf { | ||
/// The byte offset of the leaf in the file. | ||
pub offset: u64, | ||
/// The data of the leaf. | ||
pub data: Bytes, | ||
} | ||
|
||
impl std::fmt::Debug for Leaf { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nicer debug instance for leaf, unrelated change
use std::io; | ||
|
||
use crate::{blake3, BaoTree, BlockSize, TreeNode}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt
data: D, | ||
outboard: O, | ||
ranges: &ChunkRangesRef, | ||
encoded: W, | ||
) -> result::Result<(), EncodeError> { | ||
if ranges.is_empty() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
properly handle the case where ranges are empty
@@ -658,13 +661,12 @@ mod validate { | |||
use genawaiter::sync::{Co, Gen}; | |||
use positioned_io::ReadAt; | |||
|
|||
use super::Outboard; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt
@@ -74,6 +74,8 @@ | |||
//! ## Simple end to end example | |||
//! | |||
//! ```no_run | |||
//! use std::io; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt
@@ -439,13 +436,15 @@ mod test_support { | |||
(res, hash) | |||
} | |||
|
|||
/// Check that l and r of a 2-tuple are equal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt and doc strings
@@ -8,6 +8,16 @@ use bytes::Bytes; | |||
use proptest::prelude::*; | |||
use range_collections::RangeSet2; | |||
|
|||
use super::{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt
@@ -80,6 +80,19 @@ impl BlockSize { | |||
} | |||
|
|||
impl ChunkNum { | |||
/// Start (inclusive) of the chunk group that this chunk is in | |||
pub const fn chunk_group_start(start: ChunkNum, block_size: BlockSize) -> ChunkNum { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new fns to round up a set of ranges to chunk groups, needed for the new store
@@ -6,31 +6,34 @@ | |||
//! There is a proptest called <testname>_proptest that calls the test multiple times with random data. | |||
//! There is a test called <testname>_cases that calls the test with a few hardcoded values, either | |||
//! handcrafted or from a previous failure of a proptest. | |||
use std::ops::Range; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt
The mixed IO mode is using a tokio mpsc queue to communicate with an external source/sink of data, but blocking IO for the local file io.
It is used by the big blob store refactor, where I create a dedicated tokio runtime for IO and do blocking IO on that, similar to the solution that @Frando and me have come up with for database interactions.
The feature is called
experimental-mixed
so that people don't expect stability. It will get a better and less scary name once it is stable.