@@ -21,8 +21,8 @@ use std::path::PathBuf;
2121use std:: sync:: atomic:: AtomicU64 ;
2222use std:: sync:: atomic:: Ordering ;
2323use std:: sync:: Arc ;
24- use std:: thread;
2524use std:: sync:: Mutex ;
25+ use std:: thread;
2626
2727use crate :: env:: default:: LogFd ;
2828use crate :: env:: DefaultFileSystem ;
@@ -93,8 +93,8 @@ fn replace_path(path: &Path, from: &Path, to: &Path) -> PathBuf {
9393 }
9494}
9595
96-
97- // Make sure the task is sent to two disks' channel atomically, otherwise the ordering of the tasks in two disks are not same.
96+ // Make sure the task is sent to two disks' channel atomically, otherwise the
97+ // ordering of the tasks in two disks are not same.
9898#[ derive( Clone ) ]
9999struct HedgedSender ( Arc < Mutex < HedgedSenderInner > > ) ;
100100
@@ -104,7 +104,10 @@ struct HedgedSenderInner {
104104}
105105
106106impl HedgedSender {
107- fn new ( disk1 : Sender < ( Task , Callback < TaskRes > ) > , disk2 : Sender < ( Task , Callback < TaskRes > ) > ) -> Self {
107+ fn new (
108+ disk1 : Sender < ( Task , Callback < TaskRes > ) > ,
109+ disk2 : Sender < ( Task , Callback < TaskRes > ) > ,
110+ ) -> Self {
108111 Self ( Arc :: new ( Mutex :: new ( HedgedSenderInner { disk1, disk2 } ) ) )
109112 }
110113
@@ -380,7 +383,7 @@ impl HedgedFileSystem {
380383 async fn wait_one ( & self , task1 : Task , task2 : Task ) -> IoResult < ( ) > {
381384 let ( cb1, mut f1) = paired_future_callback ( ) ;
382385 let ( cb2, mut f2) = paired_future_callback ( ) ;
383- self . sender . send ( task1, task2, cb1, cb2) ;
386+ self . sender . send ( task1, task2, cb1, cb2) ;
384387
385388 select ! {
386389 res1 = f1 => res1. unwrap( ) . map( |_| ( ) ) ,
@@ -425,7 +428,8 @@ impl HedgedFileSystem {
425428
426429impl Drop for HedgedFileSystem {
427430 fn drop ( & mut self ) {
428- self . sender . send ( Task :: Stop , Task :: Stop , Box :: new ( |_| { } ) , Box :: new ( |_| { } ) ) ;
431+ self . sender
432+ . send ( Task :: Stop , Task :: Stop , Box :: new ( |_| { } ) , Box :: new ( |_| { } ) ) ;
429433 self . handle1 . take ( ) . unwrap ( ) . join ( ) . unwrap ( ) ;
430434 self . handle2 . take ( ) . unwrap ( ) . join ( ) . unwrap ( ) ;
431435 }
@@ -692,7 +696,7 @@ impl HedgedHandle {
692696 async fn wait_one ( & self , task1 : Task , task2 : Task ) -> IoResult < TaskRes > {
693697 let ( cb1, mut f1) = paired_future_callback ( ) ;
694698 let ( cb2, mut f2) = paired_future_callback ( ) ;
695- self . sender . send ( task1, task2, cb1, cb2) ;
699+ self . sender . send ( task1, task2, cb1, cb2) ;
696700
697701 select ! {
698702 res1 = f1 => res1. unwrap( ) ,
0 commit comments