repository: add PackBlob.UncompressedCiphertextLength()

This commit is contained in:
Michael Eischer
2026-06-13 20:05:05 +02:00
parent 952b310d62
commit b94ef4831d
5 changed files with 16 additions and 3 deletions
+4
View File
@@ -27,6 +27,10 @@ func (b Blob) DataLength() uint {
return uint(crypto.PlaintextLength(int(b.Length)))
}
func (b Blob) UncompressedCiphertextLength() uint {
return uint(crypto.CiphertextLength(int(b.DataLength())))
}
func (b Blob) IsCompressed() bool {
return b.UncompressedLength != 0
}
+6
View File
@@ -8,12 +8,18 @@ type PackedBlob struct {
Blob Blob
}
var _ restic.PackBlob = (*PackedBlob)(nil)
func (pb *PackedBlob) PackID() restic.ID { return pb.Pack }
func (pb *PackedBlob) Handle() restic.BlobHandle { return pb.Blob.BlobHandle }
func (pb *PackedBlob) CiphertextLength() uint { return pb.Blob.Length }
func (pb *PackedBlob) UncompressedCiphertextLength() uint {
return pb.Blob.UncompressedCiphertextLength()
}
func (pb *PackedBlob) PlaintextLength() uint { return pb.Blob.DataLength() }
func (pb *PackedBlob) IsCompressed() bool { return pb.Blob.IsCompressed() }