5
0
mirror of git://git.proxmox.com/git/pxar.git synced 2025-02-03 21:47:00 +03:00

accessor: add size method

to get the size the accessor was initially created with

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2020-05-06 11:35:46 +02:00
parent a5922fbcdc
commit a2530fb79c
2 changed files with 10 additions and 0 deletions

View File

@ -130,6 +130,10 @@ impl<T: ReadAt> AccessorImpl<T> {
})
}
pub fn size(&self) -> u64 {
self.size
}
pub async fn open_root_ref<'a>(&'a self) -> io::Result<DirectoryImpl<&'a dyn ReadAt>> {
DirectoryImpl::open_at_end(
&self.input as &dyn ReadAt,

View File

@ -94,6 +94,12 @@ impl<T: ReadAt> Accessor<T> {
self.inner
.set_goodbye_table_cache(cache.map(|cache| Arc::new(cache) as _))
}
/// Get the full archive size we're allowed to access.
#[inline]
pub fn size(&self) -> u64 {
self.inner.size()
}
}
impl<T: Clone + ReadAt> Accessor<T> {