pub struct BlockDir {
pub stats: BlockDirStats,
/* private fields */
}
Expand description
A readable, writable directory within a band holding data blocks.
Fields§
§stats: BlockDirStats
Implementations§
source§impl BlockDir
impl BlockDir
pub fn open(transport: Arc<dyn Transport>) -> BlockDir
pub fn create(transport: Arc<dyn Transport>) -> Result<BlockDir>
sourcepub fn contains(
&self,
hash: &BlockHash,
monitor: Arc<dyn Monitor>
) -> Result<bool>
pub fn contains( &self, hash: &BlockHash, monitor: Arc<dyn Monitor> ) -> Result<bool>
True if the named block is present and apparently in this blockdir.
Empty block files should never normally occur, because the index doesn’t point to empty blocks and anyhow the compression method would expand an empty block to a non-empty compressed form. However, it’s possible for an interrupted operation on a local filesystem to leave an empty file. So, these are specifically treated as missing, so there’s a chance to heal them later.
sourcepub fn compressed_size(&self, hash: &BlockHash) -> Result<u64>
pub fn compressed_size(&self, hash: &BlockHash) -> Result<u64>
Returns the compressed on-disk size of a block.
sourcepub fn read_address(
&self,
address: &Address,
monitor: Arc<dyn Monitor>
) -> Result<Bytes>
pub fn read_address( &self, address: &Address, monitor: Arc<dyn Monitor> ) -> Result<Bytes>
Read back some content addressed by an Address (a block hash, start and end).
sourcepub fn get_block_content(
&self,
hash: &BlockHash,
monitor: Arc<dyn Monitor>
) -> Result<Bytes>
pub fn get_block_content( &self, hash: &BlockHash, monitor: Arc<dyn Monitor> ) -> Result<Bytes>
Return the entire contents of the block.
Checks that the hash is correct with the contents.
pub fn delete_block(&self, hash: &BlockHash) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for BlockDir
impl Send for BlockDir
impl Sync for BlockDir
impl Unpin for BlockDir
impl !UnwindSafe for BlockDir
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more