Skip to content

Commit 3c388c5

Browse files
author
Devdutt Shenoi
committed
refactor: map
1 parent 77875b8 commit 3c388c5

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/hottier.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,19 @@ impl HotTierManager {
7272
pub fn global() -> Option<&'static HotTierManager> {
7373
static INSTANCE: OnceCell<HotTierManager> = OnceCell::new();
7474

75-
let hot_tier_path = &CONFIG.options.hot_tier_storage_path;
76-
if hot_tier_path.is_none() {
77-
return None;
78-
}
79-
Some(INSTANCE.get_or_init(|| {
80-
let hot_tier_path = hot_tier_path.as_ref().unwrap().clone();
75+
CONFIG
76+
.options
77+
.hot_tier_storage_path
78+
.clone()
79+
.map(|hot_tier_path| {
80+
INSTANCE.get_or_init(|| {
8181
std::fs::create_dir_all(&hot_tier_path).unwrap();
8282
HotTierManager {
8383
filesystem: LocalFileSystem::new(),
8484
hot_tier_path,
8585
}
86-
}))
86+
})
87+
})
8788
}
8889

8990
///get the total hot tier size for all streams

0 commit comments

Comments
 (0)