mirror of
git://git.proxmox.com/git/pxar.git
synced 2025-03-11 20:58:47 +03:00
encoder: add payload position capability
Allows to read the current payload offset from the dedicated payload input stream. This is required to get the current offset for calculation of forced boundaries in the proxmox-backup-client, when injecting reused payload chunks into the payload stream. Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
parent
15fbb28319
commit
2c1daa75fa
@ -75,6 +75,11 @@ impl<'a, T: SeqWrite + 'a> Encoder<'a, T> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Get current position for payload stream
|
||||
pub fn payload_position(&self) -> io::Result<PayloadOffset> {
|
||||
self.inner.payload_position()
|
||||
}
|
||||
|
||||
// /// Convenience shortcut to add a *regular* file by path including its contents to the archive.
|
||||
// pub async fn add_file<P, F>(
|
||||
// &mut self,
|
||||
|
@ -524,6 +524,10 @@ impl<'a, T: SeqWrite + 'a> EncoderImpl<'a, T> {
|
||||
Ok(offset)
|
||||
}
|
||||
|
||||
pub fn payload_position(&self) -> io::Result<PayloadOffset> {
|
||||
Ok(PayloadOffset(self.state()?.payload_position()))
|
||||
}
|
||||
|
||||
/// Encode a payload reference pointing to given offset in the separate payload output
|
||||
///
|
||||
/// Returns a file offset usable with `add_hardlink` or with error if the encoder instance has
|
||||
|
@ -97,6 +97,11 @@ impl<'a, T: SeqWrite + 'a> Encoder<'a, T> {
|
||||
))
|
||||
}
|
||||
|
||||
/// Get current payload position for payload stream
|
||||
pub fn payload_position(&self) -> io::Result<PayloadOffset> {
|
||||
self.inner.payload_position()
|
||||
}
|
||||
|
||||
/// Encode a payload reference pointing to given offset in the separate payload output
|
||||
///
|
||||
/// Returns with error if the encoder instance has no separate payload output or encoding
|
||||
|
Loading…
x
Reference in New Issue
Block a user