diff --git a/ledger/src/blocktree.rs b/ledger/src/blocktree.rs index 676ee8e96..3cdbd7258 100644 --- a/ledger/src/blocktree.rs +++ b/ledger/src/blocktree.rs @@ -1493,6 +1493,8 @@ impl Blocktree { self.last_root() } + // return the approximate size in bytes of the storage directory, or `None` if an error occurs + // while reading the directory (directory not found, file deleted, etc) pub fn storage_size(&self) -> Option { self.db.storage_size() } diff --git a/ledger/src/blocktree_db.rs b/ledger/src/blocktree_db.rs index 7df26a1dd..641bcec95 100644 --- a/ledger/src/blocktree_db.rs +++ b/ledger/src/blocktree_db.rs @@ -580,6 +580,8 @@ impl Database { self.backend.write(batch.write_batch) } + // return the approximate size in bytes of the storage directory, or `None` if an error occurs + // while reading the directory (directory not found, file deleted, etc) pub fn storage_size(&self) -> Option { get_size(&self.path).ok() }