src/pxar/decoder.rs: add getter functions to obtain start/end offsets for directories

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2019-09-03 14:14:29 +02:00 committed by Dietmar Maurer
parent 3626ac611f
commit c7fee396c6
1 changed files with 14 additions and 0 deletions

View File

@ -19,6 +19,16 @@ pub struct DirectoryEntry {
pub entry: PxarEntry, pub entry: PxarEntry,
} }
impl DirectoryEntry {
pub(crate) fn start_offset(&self) -> u64 {
self.start
}
pub(crate) fn end_offset(&self) -> u64 {
self.end
}
}
// This one needs Read+Seek // This one needs Read+Seek
pub struct Decoder<R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> { pub struct Decoder<R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> {
inner: SequentialDecoder<R, F>, inner: SequentialDecoder<R, F>,
@ -58,6 +68,10 @@ impl<R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> Decoder<R, F> {
Ok(pos) Ok(pos)
} }
pub(crate) fn root_end_offset(&self) -> u64 {
self.root_end
}
pub fn restore(&mut self, dir: &DirectoryEntry, path: &Path) -> Result<(), Error> { pub fn restore(&mut self, dir: &DirectoryEntry, path: &Path) -> Result<(), Error> {
let start = dir.start; let start = dir.start;