change blocktree*::storage_size() to return Option<u64> to handle live fs changes (#7401)
This commit is contained in:
parent
12d471e2da
commit
06415de8ee
|
@ -66,6 +66,9 @@ impl LedgerCleanupService {
|
|||
|
||||
let disk_utilization_post = blocktree.storage_size();
|
||||
|
||||
if let (Some(disk_utilization_pre), Some(disk_utilization_post)) =
|
||||
(disk_utilization_pre, disk_utilization_post)
|
||||
{
|
||||
datapoint_debug!(
|
||||
"ledger_disk_utilization",
|
||||
("disk_utilization_pre", disk_utilization_pre as i64, i64),
|
||||
|
@ -76,6 +79,7 @@ impl LedgerCleanupService {
|
|||
i64
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -1493,7 +1493,7 @@ impl Blocktree {
|
|||
self.last_root()
|
||||
}
|
||||
|
||||
pub fn storage_size(&self) -> u64 {
|
||||
pub fn storage_size(&self) -> Option<u64> {
|
||||
self.db.storage_size()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -580,8 +580,8 @@ impl Database {
|
|||
self.backend.write(batch.write_batch)
|
||||
}
|
||||
|
||||
pub fn storage_size(&self) -> u64 {
|
||||
get_size(&self.path).expect("failure while reading ledger directory size")
|
||||
pub fn storage_size(&self) -> Option<u64> {
|
||||
get_size(&self.path).ok()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue