pack

package
v0.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2018 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package pack provides functions for combining and parsing pack files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List(k *crypto.Key, rd io.ReaderAt, size int64) (entries []restic.Blob, err error)

List returns the list of entries found in a pack file.

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 NewPacker

func NewPacker(k *crypto.Key, wr io.Writer) *Packer

NewPacker returns a new Packer that can be used to pack blobs together. If wr is nil, a bytes.Buffer is used.

func (*Packer) Add

func (p *Packer) Add(t restic.BlobType, id restic.ID, data []byte) (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.

func (*Packer) Blobs

func (p *Packer) Blobs() []restic.Blob

Blobs returns the slice of blobs that have been written.

func (*Packer) Count

func (p *Packer) Count() int

Count returns the number of blobs in this packer.

func (*Packer) Finalize

func (p *Packer) Finalize() (uint, error)

Finalize writes the header for all added blobs and finalizes the pack. Returned are the number of bytes written, including the header. If the underlying writer implements io.Closer, it is closed.

func (*Packer) Size

func (p *Packer) Size() uint

Size returns the number of bytes written so far.

func (*Packer) String

func (p *Packer) String() string

func (*Packer) Writer

func (p *Packer) Writer() io.Writer

Writer return the underlying writer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL