Documentation
¶
Overview ¶
Package pack provides functions for combining and parsing pack files.
Index ¶
- Constants
- Variables
- func CalculateEntrySize(blob restic.Blob) int
- func CalculateHeaderSize(blobs []restic.Blob) int
- func List(k *crypto.Key, rd io.ReaderAt, size int64) (entries []restic.Blob, hdrSize uint32, err error)
- func Size(ctx context.Context, mi restic.ListBlobser, onlyHdr bool) (map[restic.ID]int64, error)
- type InvalidFileError
- type Packer
- func (p *Packer) Add(t restic.BlobType, id restic.ID, data []byte, uncompressedLength int) (int, error)
- func (p *Packer) Blobs() []restic.Blob
- func (p *Packer) Count() int
- func (p *Packer) Finalize() error
- func (p *Packer) HeaderFull() bool
- func (p *Packer) HeaderOverhead() int
- func (p *Packer) Merge(other *Packer, otherData io.Reader) error
- func (p *Packer) Size() uint
- func (p *Packer) String() string
Constants ¶
View Source
const (
// MaxHeaderSize is the max size of header including header-length field
MaxHeaderSize = 16*1024*1024 + headerLengthSize
)
Variables ¶
View Source
var ( // MaxHeaderEntries is the number of entries a pack file can contain at most MaxHeaderEntries = (MaxHeaderSize - headerSize) / entrySize )
Functions ¶
func CalculateEntrySize ¶
func CalculateHeaderSize ¶
func List ¶
func List(k *crypto.Key, rd io.ReaderAt, size int64) (entries []restic.Blob, hdrSize uint32, err error)
List returns the list of entries found in a pack file and the length of the header (including header size and crypto overhead)
Types ¶
type InvalidFileError ¶
type InvalidFileError struct {
Message string
}
InvalidFileError is return when a file is found that is not a pack file.
func (InvalidFileError) Error ¶
func (e InvalidFileError) Error() string
type Packer ¶
type Packer struct {
// contains filtered or unexported fields
}
Packer is used to create a new Pack.
func (*Packer) Add ¶
func (p *Packer) Add(t restic.BlobType, id restic.ID, data []byte, uncompressedLength int) (int, error)
Add saves the data read from rd as a new blob to the packer. Returned is the number of bytes written to the pack plus the pack header entry size.
func (*Packer) HeaderFull ¶
HeaderFull returns true if the pack header is full.
func (*Packer) HeaderOverhead ¶
HeaderOverhead returns an estimate of the number of bytes written by a call to Finalize.
Click to show internal directories.
Click to hide internal directories.