1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-23 08:16:36 +00:00

Make some pack parameters public

This commit is contained in:
Alexander Weiss 2020-05-01 22:56:34 +02:00 committed by Alexander Neumann
parent 0db9024aad
commit 581d90cf91

View file

@ -161,13 +161,16 @@ func (p *Packer) String() string {
} }
var ( var (
// size of the header-length field at the end of the file
headerLengthSize = binary.Size(uint32(0))
// we require at least one entry in the header, and one blob for a pack file // we require at least one entry in the header, and one blob for a pack file
minFileSize = entrySize + crypto.Extension + uint(headerLengthSize) minFileSize = entrySize + crypto.Extension + uint(headerLengthSize)
) )
const ( const (
// size of the header-length field at the end of the file; it is a uint32
headerLengthSize = 4
// constant overhead of the header independent of #entries
HeaderSize = headerLengthSize + crypto.Extension
maxHeaderSize = 16 * 1024 * 1024 maxHeaderSize = 16 * 1024 * 1024
// number of header enries to download as part of header-length request // number of header enries to download as part of header-length request
eagerEntries = 15 eagerEntries = 15
@ -315,3 +318,8 @@ func List(k *crypto.Key, rd io.ReaderAt, size int64) (entries []restic.Blob, err
return entries, nil return entries, nil
} }
// PackedSizeOfBlob returns the size a blob actually uses when saved in a pack
func PackedSizeOfBlob(blobLength uint) uint {
return blobLength + entrySize
}