@@ -78,11 +78,11 @@ impl HotTierManager {
78
78
. clone ( )
79
79
. map ( |hot_tier_path| {
80
80
INSTANCE . get_or_init ( || {
81
- std:: fs:: create_dir_all ( & hot_tier_path) . unwrap ( ) ;
82
- HotTierManager {
83
- filesystem : LocalFileSystem :: new ( ) ,
84
- hot_tier_path,
85
- }
81
+ std:: fs:: create_dir_all ( & hot_tier_path) . unwrap ( ) ;
82
+ HotTierManager {
83
+ filesystem : LocalFileSystem :: new ( ) ,
84
+ hot_tier_path,
85
+ }
86
86
} )
87
87
} )
88
88
}
@@ -391,9 +391,8 @@ impl HotTierManager {
391
391
. sort_by_key ( |file| file. file_path . clone ( ) ) ;
392
392
// write the manifest file to the hot tier directory
393
393
let manifest_path = self
394
- . hot_tier_path
395
- . join ( stream)
396
- . join ( format ! ( "date={}/hottier.manifest.json" , date) ) ;
394
+ . get_stream_path_for_date ( stream, & date)
395
+ . join ( "hottier.manifest.json" ) ;
397
396
fs:: create_dir_all ( manifest_path. parent ( ) . unwrap ( ) ) . await ?;
398
397
fs:: write ( manifest_path, serde_json:: to_vec ( & hot_tier_manifest) ?) . await ?;
399
398
Ok ( file_processed)
@@ -408,7 +407,7 @@ impl HotTierManager {
408
407
dates : & [ NaiveDate ] ,
409
408
) -> Result < ( ) , HotTierError > {
410
409
for date in dates. iter ( ) {
411
- let path = self . hot_tier_path . join ( format ! ( "{}/date={}" , stream, date) ) ;
410
+ let path = self . get_stream_path_for_date ( stream, & date) ;
412
411
if path. exists ( ) {
413
412
fs:: remove_dir_all ( path. clone ( ) ) . await ?;
414
413
}
@@ -562,11 +561,7 @@ impl HotTierManager {
562
561
let mut delete_successful = false ;
563
562
let dates = self . fetch_hot_tier_dates ( stream) . await ?;
564
563
' loop_dates: for date in dates {
565
- let date_str = date. to_string ( ) ;
566
- let path = & self
567
- . hot_tier_path
568
- . join ( stream)
569
- . join ( format ! ( "date={}" , date_str) ) ;
564
+ let path = self . get_stream_path_for_date ( stream, & date) ;
570
565
if !path. exists ( ) {
571
566
continue ;
572
567
}
@@ -588,12 +583,7 @@ impl HotTierManager {
588
583
589
584
' loop_files: while let Some ( file_to_delete) = manifest. files . pop ( ) {
590
585
let file_size = file_to_delete. file_size ;
591
- let path_to_delete = CONFIG
592
- . options
593
- . hot_tier_storage_path
594
- . as_ref ( )
595
- . unwrap ( )
596
- . join ( & file_to_delete. file_path ) ;
586
+ let path_to_delete = self . hot_tier_path . join ( & file_to_delete. file_path ) ;
597
587
598
588
if path_to_delete. exists ( ) {
599
589
if let ( Some ( download_date_time) , Some ( delete_date_time) ) = (
@@ -670,11 +660,7 @@ impl HotTierManager {
670
660
}
671
661
672
662
for date in date_list {
673
- let path = self
674
- . hot_tier_path
675
- . join ( stream)
676
- . join ( format ! ( "date={}" , date) ) ;
677
-
663
+ let path = self . get_stream_path_for_date ( stream, & date) ;
678
664
let hours_dir = ReadDirStream :: new ( fs:: read_dir ( & path) . await ?) ;
679
665
let mut hours: Vec < DirEntry > = hours_dir. try_collect ( ) . await ?;
680
666
hours. retain ( |entry| {
0 commit comments