@@ -66,8 +66,6 @@ impl SimpleBatchCoordinator {
6666
6767 /// Opens or creates the underlying file depending on it's existence.
6868 fn open_or_create_file ( current_partition_file : & PathBuf ) -> RisklessResult < File > {
69- tracing:: info!( "File {:#?} exists." , current_partition_file) ;
70-
7169 let file = match current_partition_file. exists ( ) {
7270 true => {
7371 let mut open_opts = OpenOptions :: new ( ) ;
@@ -76,14 +74,8 @@ impl SimpleBatchCoordinator {
7674
7775 open_opts. open ( current_partition_file)
7876 }
79- false => {
80- tracing:: info!( "Actually doing this.." ) ;
81- std:: fs:: File :: create ( current_partition_file)
82- }
77+ false => std:: fs:: File :: create ( current_partition_file) ,
8378 } ;
84-
85- tracing:: info!( "Result from file: {:#?}" , file) ;
86-
8779 Ok ( file?)
8880 }
8981
@@ -118,8 +110,6 @@ impl CommitFile for SimpleBatchCoordinator {
118110
119111 let file = Self :: open_or_create_file ( current_partition_file) ;
120112
121- tracing:: info!( "Result from file: {:#?}" , file) ;
122-
123113 match file {
124114 Ok ( mut file) => {
125115 let offset = batch. byte_offset ;
@@ -148,8 +138,6 @@ impl CommitFile for SimpleBatchCoordinator {
148138 is_duplicate : false ,
149139 request : batch,
150140 } ) ;
151- tracing:: info!( "Error when creating index file: {:#?}" , err) ;
152- // TODO: File error and return to result.
153141 }
154142 }
155143 }
@@ -181,8 +169,6 @@ impl FindBatches for SimpleBatchCoordinator {
181169
182170 match file {
183171 Ok ( mut file) => {
184- tracing:: info!( "Reading from position: {:#?}" , request. offset) ;
185-
186172 let size_in_u64: u64 = match Index :: packed_size ( ) . try_into ( ) {
187173 Ok ( s) => s,
188174 Err ( err) => {
@@ -246,8 +232,6 @@ impl FindBatches for SimpleBatchCoordinator {
246232
247233 match index {
248234 Ok ( index) => {
249- tracing:: info!( "Received Index: {:#?}" , index) ;
250-
251235 results. push ( FindBatchResponse {
252236 errors : vec ! [ ] ,
253237 batches : vec ! [ BatchInfo {
@@ -282,10 +266,7 @@ impl FindBatches for SimpleBatchCoordinator {
282266 }
283267 }
284268 }
285- Err ( err) => {
286- tracing:: info!( "Error when creating index file: {:#?}" , err) ;
287- // TODO: File error and return to result.
288- }
269+ Err ( _err) => { }
289270 }
290271 }
291272
@@ -338,13 +319,13 @@ mod tests {
338319 fn set_up_dirs ( ) -> PathBuf {
339320 let mut batch_coord_path = std:: env:: temp_dir ( ) ;
340321 batch_coord_path. push ( uuid:: Uuid :: new_v4 ( ) . to_string ( ) ) ;
341- std:: fs:: create_dir ( & batch_coord_path) . unwrap ( ) ;
322+ std:: fs:: create_dir ( & batch_coord_path) . expect ( "" ) ;
342323
343324 batch_coord_path
344325 }
345326
346327 fn tear_down_dirs ( batch_coord : PathBuf ) {
347- std:: fs:: remove_dir_all ( & batch_coord) . unwrap ( ) ;
328+ std:: fs:: remove_dir_all ( & batch_coord) . expect ( "" ) ;
348329 }
349330
350331 #[ test]
@@ -361,7 +342,7 @@ mod tests {
361342 fn test_topic_dir_creates_directory_if_not_exists ( ) {
362343 let temp_dir = set_up_dirs ( ) ;
363344
364- let coordinator = SimpleBatchCoordinator :: new ( temp_dir. to_str ( ) . unwrap ( ) . to_string ( ) ) ;
345+ let coordinator = SimpleBatchCoordinator :: new ( temp_dir. to_str ( ) . expect ( "" ) . to_string ( ) ) ;
365346
366347 let topic = "test_topic" . to_string ( ) ;
367348
@@ -383,13 +364,13 @@ mod tests {
383364 fn test_topic_dir_uses_existing_directory ( ) {
384365 let temp_dir = set_up_dirs ( ) ;
385366
386- let coordinator = SimpleBatchCoordinator :: new ( temp_dir. to_str ( ) . unwrap ( ) . to_string ( ) ) ;
367+ let coordinator = SimpleBatchCoordinator :: new ( temp_dir. to_str ( ) . expect ( "" ) . to_string ( ) ) ;
387368
388369 let topic = "existing_topic" . to_string ( ) ;
389370
390371 // Create the directory manually first
391372 let expected_path = temp_dir. join ( & topic) ;
392- fs:: create_dir ( & expected_path) . unwrap ( ) ;
373+ fs:: create_dir ( & expected_path) . expect ( "" ) ;
393374
394375 // Call topic_dir
395376 let result = coordinator. topic_dir ( topic. clone ( ) ) ;
@@ -408,7 +389,7 @@ mod tests {
408389 SimpleBatchCoordinator :: partition_index_file_from_topic_dir ( & mut topic_dir, partition) ;
409390
410391 assert_eq ! (
411- result. to_str( ) . unwrap ( ) ,
392+ result. to_str( ) . expect ( "" ) ,
412393 "test_topic/00000000000000000042.index"
413394 ) ;
414395 }
@@ -437,7 +418,7 @@ mod tests {
437418 let file_path = temp_dir. join ( "existing_file.index" ) ;
438419
439420 // Create the file first
440- File :: create ( & file_path) . unwrap ( ) ;
421+ File :: create ( & file_path) . expect ( "" ) ;
441422
442423 // Try to open
443424 let result = SimpleBatchCoordinator :: open_or_create_file ( & file_path) ;
@@ -451,7 +432,7 @@ mod tests {
451432 let file_path = temp_dir. join ( "test_open_file.index" ) ;
452433
453434 // Create the file first
454- File :: create ( & file_path) . unwrap ( ) ;
435+ File :: create ( & file_path) . expect ( "" ) ;
455436
456437 // Try to open
457438 let result = SimpleBatchCoordinator :: open_file ( & file_path) ;
@@ -475,7 +456,7 @@ mod tests {
475456 async fn test_commit_file_creates_index_file ( ) {
476457 let temp_dir = set_up_dirs ( ) ;
477458
478- let coordinator = SimpleBatchCoordinator :: new ( temp_dir. to_str ( ) . unwrap ( ) . to_string ( ) ) ;
459+ let coordinator = SimpleBatchCoordinator :: new ( temp_dir. to_str ( ) . expect ( "" ) . to_string ( ) ) ;
479460
480461 let whole_dir = temp_dir. clone ( ) ;
481462
@@ -508,18 +489,13 @@ mod tests {
508489 // Commit the file
509490 coordinator. commit_file ( object_key, 1 , 100 , batches) . await ;
510491
511- tracing:: info!(
512- "{:#?}" ,
513- std:: fs:: read_dir( & whole_dir) . unwrap( ) . collect:: <Vec <_>>( )
514- ) ;
515-
516492 // File should now exist
517493 assert ! ( expected_file_path. exists( ) ) ;
518494
519495 // Verify file contents
520- let mut file = File :: open ( & expected_file_path) . unwrap ( ) ;
496+ let mut file = File :: open ( & expected_file_path) . expect ( "" ) ;
521497 let mut buf = [ 0u8 ; 28 ] ; // Assuming Index is 28 bytes
522- file. read_exact ( & mut buf) . unwrap ( ) ;
498+ file. read_exact ( & mut buf) . expect ( "" ) ;
523499
524500 // You might want to add more specific assertions about the contents
525501 assert_ne ! ( buf, [ 0u8 ; 28 ] ) ;
@@ -530,7 +506,7 @@ mod tests {
530506 async fn test_find_batches_reads_correct_data ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
531507 let temp_dir = set_up_dirs ( ) ;
532508
533- let coordinator = SimpleBatchCoordinator :: new ( temp_dir. to_str ( ) . unwrap ( ) . to_string ( ) ) ;
509+ let coordinator = SimpleBatchCoordinator :: new ( temp_dir. to_str ( ) . expect ( "" ) . to_string ( ) ) ;
534510
535511 // TODO: This behaviour likely needs to be implemented in the SimpleBatchCoordinator.
536512 let data_path = temp_dir. clone ( ) ;
@@ -594,7 +570,7 @@ mod tests {
594570 async fn test_multiple_writes ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
595571 let temp_dir = set_up_dirs ( ) ;
596572
597- let coordinator = SimpleBatchCoordinator :: new ( temp_dir. to_str ( ) . unwrap ( ) . to_string ( ) ) ;
573+ let coordinator = SimpleBatchCoordinator :: new ( temp_dir. to_str ( ) . expect ( "" ) . to_string ( ) ) ;
598574
599575 // TODO: This behaviour likely needs to be implemented in the SimpleBatchCoordinator.
600576 let data_path = temp_dir. clone ( ) ;
@@ -673,12 +649,8 @@ mod tests {
673649
674650 index_path. push ( & topic) ;
675651
676- tracing:: info!( "{:#?}" , std:: fs:: read_dir( & index_path) ?. collect:: <Vec <_>>( ) ) ;
677-
678652 index_path. push ( format ! ( "{:0>20}.index" , partition. to_string( ) ) ) ;
679653
680- tracing:: info!( "{:#?}" , index_path) ;
681-
682654 let data = std:: fs:: read ( index_path) ?;
683655
684656 assert_eq ! ( data. len( ) , Index :: packed_size( ) * 3 ) ;
@@ -731,7 +703,7 @@ mod tests {
731703 async fn test_find_batches_handles_missing_file ( ) {
732704 let temp_dir = set_up_dirs ( ) ;
733705
734- let coordinator = SimpleBatchCoordinator :: new ( temp_dir. to_str ( ) . unwrap ( ) . to_string ( ) ) ;
706+ let coordinator = SimpleBatchCoordinator :: new ( temp_dir. to_str ( ) . expect ( "" ) . to_string ( ) ) ;
735707
736708 let find_requests = vec ! [ FindBatchRequest {
737709 topic_id_partition: TopicIdPartition ( "nonexistent_topic" . to_string( ) , 1 ) ,
0 commit comments