Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //TarArchiverKey configures the one object key returned by the tar Archiver TarArchiverKey = "archive.tar" //TarArchiverPathSeparator standardizes the header path for cross platform (un)archiving TarArchiverPathSeparator = "/" //ErrNoSuchDirectory is returned when an archiver expected a directory to exist ErrNoSuchDirectory = errors.New("directory doesn't exist") //ErrEmptyDirectory is returned when the archiver expected the directory to not be empty ErrEmptyDirectory = errors.New("directory is empty") )
Functions ¶
This section is empty.
Types ¶
type ArchiverOptions ¶
type ArchiverOptions struct {
Type ArchiverType `json:"type"`
TarArchiverKeyPrefix string `json:"keyPrefix"`
}
ArchiverOptions contain options for all stores
type ArchiverType ¶
type ArchiverType string
ArchiverType determines what type the object store will be
const ( //ArchiverTypeTar uses the tar archiving format ArchiverTypeTar ArchiverType = "tar" )
type Reporter ¶
type Reporter interface {
StartArchivingProgress(label string, total int64) func(int64)
StopArchivingProgress()
StartUnarchivingProgress(label string, total int64, rr io.Reader) io.Reader
StopUnarchivingProgress()
}
Reporter describes how an archiver reports
type TarArchiver ¶
type TarArchiver struct {
// contains filtered or unexported fields
}
TarArchiver will archive a directory into a single tar file
func NewTarArchiver ¶
func NewTarArchiver(opts ArchiverOptions) (a *TarArchiver, err error)
NewTarArchiver will setup the tar archiver
func (*TarArchiver) Archive ¶
func (a *TarArchiver) Archive(path string, rep Reporter, fn func(k string, r io.ReadSeeker, nbytes int64) error) (err error)
Archive will archive a directory at 'path' into readable objects 'r' and calls 'fn' for each
func (*TarArchiver) Index ¶
func (a *TarArchiver) Index(fn func(k string) error) error
Index calls 'fn' for all object keys that are part of the archive
func (*TarArchiver) Unarchive ¶
func (a *TarArchiver) Unarchive(path string, rep Reporter, fn func(k string, w io.WriterAt) error) error
Unarchive will take a file system path and call 'fn' for each object that it needs for unarchiving. It writes to a temporary directory first and then moves this to the final location
Click to show internal directories.
Click to hide internal directories.