File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed
Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -66,8 +66,6 @@ use std::{fmt::Debug, fs::OpenOptions};
6666
6767use anyhow:: Result ;
6868
69- use crate :: process:: Process ;
70-
7169/// Carries the implementation specific data for complete file transfers into the executor.
7270#[ derive( Debug ) ]
7371pub ( crate ) enum FileBuffer {
@@ -443,11 +441,11 @@ pub(crate) fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
443441/// Get the executor for disk IO.
444442pub ( crate ) fn get_executor < ' a > (
445443 ram_budget : usize ,
446- process : & Process ,
447- ) -> Result < Box < dyn Executor + ' a > > {
444+ io_thread_count : usize ,
445+ ) -> Box < dyn Executor + ' a > {
448446 // If this gets lots of use, consider exposing via the config file.
449- Ok ( match process . io_thread_count ( ) ? {
447+ match io_thread_count {
450448 0 | 1 => Box :: new ( immediate:: ImmediateUnpacker :: new ( ) ) ,
451449 n => Box :: new ( threaded:: Threaded :: new ( n, ram_budget) ) ,
452- } )
450+ }
453451}
Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ fn test_incremental_file(io_threads: &str) -> Result<()> {
2424
2525 let mut written = 0 ;
2626 let mut file_finished = false ;
27- let mut io_executor: Box < dyn Executor > = get_executor ( 32 * 1024 * 1024 , & tp. process ) ?;
27+ let mut io_executor: Box < dyn Executor > =
28+ get_executor ( 32 * 1024 * 1024 , tp. process . io_thread_count ( ) ?) ;
2829 let ( item, mut sender) = Item :: write_file_segmented (
2930 work_dir. path ( ) . join ( "scratch" ) ,
3031 0o666 ,
@@ -90,7 +91,8 @@ fn test_complete_file(io_threads: &str) -> Result<()> {
9091 vars. insert ( "RUSTUP_IO_THREADS" . to_string ( ) , io_threads. to_string ( ) ) ;
9192 let tp = TestProcess :: with_vars ( vars) ;
9293
93- let mut io_executor: Box < dyn Executor > = get_executor ( 32 * 1024 * 1024 , & tp. process ) ?;
94+ let mut io_executor: Box < dyn Executor > =
95+ get_executor ( 32 * 1024 * 1024 , tp. process . io_thread_count ( ) ?) ;
9496 let mut chunk = io_executor. get_buffer ( 10 ) ;
9597 chunk. extend ( b"0123456789" ) ;
9698 assert_eq ! ( chunk. len( ) , 10 ) ;
Original file line number Diff line number Diff line change @@ -285,7 +285,7 @@ fn unpack_without_first_dir<R: Read>(
285285 }
286286 } ;
287287 let unpack_ram = unpack_ram ( IO_CHUNK_SIZE , effective_max_ram, dl_cfg) ;
288- let mut io_executor: Box < dyn Executor > = get_executor ( unpack_ram, dl_cfg. process ) ? ;
288+ let mut io_executor = get_executor ( unpack_ram, dl_cfg. process . io_thread_count ( ) ? ) ;
289289
290290 let mut directories: HashMap < PathBuf , DirStatus > = HashMap :: new ( ) ;
291291 // Path is presumed to exist. Call it a precondition.
You can’t perform that action at this time.
0 commit comments