File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -68,26 +68,27 @@ pub struct StreamHotTier {
68
68
69
69
pub struct HotTierManager {
70
70
filesystem : LocalFileSystem ,
71
- hot_tier_path : PathBuf ,
71
+ hot_tier_path : & ' static Path ,
72
72
}
73
73
74
74
impl HotTierManager {
75
+ pub fn new ( hot_tier_path : & ' static Path ) -> Self {
76
+ std:: fs:: create_dir_all ( hot_tier_path) . unwrap ( ) ;
77
+ HotTierManager {
78
+ filesystem : LocalFileSystem :: new ( ) ,
79
+ hot_tier_path,
80
+ }
81
+ }
82
+
83
+ /// Get a global
75
84
pub fn global ( ) -> Option < & ' static HotTierManager > {
76
85
static INSTANCE : OnceCell < HotTierManager > = OnceCell :: new ( ) ;
77
86
78
87
CONFIG
79
88
. options
80
89
. hot_tier_storage_path
81
- . clone ( )
82
- . map ( |hot_tier_path| {
83
- INSTANCE . get_or_init ( || {
84
- std:: fs:: create_dir_all ( & hot_tier_path) . unwrap ( ) ;
85
- HotTierManager {
86
- filesystem : LocalFileSystem :: new ( ) ,
87
- hot_tier_path,
88
- }
89
- } )
90
- } )
90
+ . as_ref ( )
91
+ . map ( |hot_tier_path| INSTANCE . get_or_init ( || HotTierManager :: new ( hot_tier_path) ) )
91
92
}
92
93
93
94
///get the total hot tier size for all streams
You can’t perform that action at this time.
0 commit comments