feat: ledger size and cleanup metrics (#7335)
This commit is contained in:
@@ -1469,6 +1469,10 @@ impl Blocktree {
|
||||
// This means blocktree is empty, should never get here aside from right at boot.
|
||||
self.last_root()
|
||||
}
|
||||
|
||||
pub fn storage_size(&self) -> u64 {
|
||||
self.db.storage_size()
|
||||
}
|
||||
}
|
||||
|
||||
fn update_slot_meta(
|
||||
|
@@ -1,6 +1,7 @@
|
||||
use crate::blocktree_meta;
|
||||
use bincode::{deserialize, serialize};
|
||||
use byteorder::{BigEndian, ByteOrder};
|
||||
use fs_extra::dir::get_size;
|
||||
use log::*;
|
||||
pub use rocksdb::Direction as IteratorDirection;
|
||||
use rocksdb::{
|
||||
@@ -484,6 +485,7 @@ impl TypedColumn for columns::ErasureMeta {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Database {
|
||||
backend: Arc<Rocks>,
|
||||
path: Arc<Path>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -504,7 +506,10 @@ impl Database {
|
||||
pub fn open(path: &Path) -> Result<Self> {
|
||||
let backend = Arc::new(Rocks::open(path)?);
|
||||
|
||||
Ok(Database { backend })
|
||||
Ok(Database {
|
||||
backend,
|
||||
path: Arc::from(path),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn destroy(path: &Path) -> Result<()> {
|
||||
@@ -576,6 +581,10 @@ impl Database {
|
||||
pub fn write(&self, batch: WriteBatch) -> Result<()> {
|
||||
self.backend.write(batch.write_batch)
|
||||
}
|
||||
|
||||
pub fn storage_size(&self) -> u64 {
|
||||
get_size(&self.path).expect("failure while reading ledger directory size")
|
||||
}
|
||||
}
|
||||
|
||||
impl<C> LedgerColumn<C>
|
||||
|
Reference in New Issue
Block a user