neptune-archive 0.14.0

Neptune archival state: on-disk block storage, the archival block MMR, the archival mutator set, and the optional UTXO index
1
2
3
4
5
6
7
8
9
use tokio::fs;

pub const MAX_BLOCK_FILE_SIZE: u64 = 1024 * 1024 * 128; // 128 Mebibyte

/// Return a boolean indicating if a new file is needed or, in the negative sense, we can continue
/// writing to the current file.
pub async fn new_block_file_is_needed(file: &fs::File, bytes_to_store: u64) -> bool {
    file.metadata().await.unwrap().len() + bytes_to_store > MAX_BLOCK_FILE_SIZE
}