tarutil

package module
v0.0.0-...-a7029cb Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

README

tarutil

GoDoc Build Status Go Report Card

This library is a collection of Go utilities to handle tar archives.

This library contains only code which can unpack tar archives with AUFS whiteouts.

The layer unpacking code is based on Docker's pkg/archive.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterTarUsingFilter

func FilterTarUsingFilter(r io.Reader, f TarFilter) (io.Reader, error)

FilterTarUsingFilter accepts a tar file in the io.Reader and a Tarfilter, and then runs the filter repeatedly on the reader.

func Lgetxattr

func Lgetxattr(path string, attr string) ([]byte, error)

Lgetxattr retrieves the value of the extended attribute identified by attr and associated with the given path in the file system. It will returns a nil slice and nil error if the xattr is not set.

func Lsetxattr

func Lsetxattr(path string, attr string, data []byte, flags int) error

Lsetxattr sets the value of the extended attribute identified by attr and associated with the given path in the file system.

func OpenAndUnpack

func OpenAndUnpack(ctx context.Context, layerPath, dest string, options *Options) error

OpenAndUnpack unpacks a specified file into the destination.

func OpenAndUnpackMulti

func OpenAndUnpackMulti(ctx context.Context, layers []string, dest string, options *Options) error

OpenAndUnpackMulti unpacks multiple files into the destination.

func Pack

func Pack(ctx context.Context, source string, w io.Writer) error

Pack packs a tarball from the specified source, into the writer w. Returns an error.

func Unpack

func Unpack(ctx context.Context, r io.Reader, dest string, options *Options) error

Unpack unpacks a tar file into the destination.

Types

type AUFSWhiteouts

type AUFSWhiteouts struct {
	// contains filtered or unexported fields
}

AUFSWhiteouts is a TarFilter to convert overlay whiteouts to aufs whiteouts.

func NewAUFSWhiteouts

func NewAUFSWhiteouts() *AUFSWhiteouts

NewAUFSWhiteouts creates a new overlay whiteout filter.

func (*AUFSWhiteouts) Close

func (o *AUFSWhiteouts) Close() error

Close closes the tar filter, finalizing any processing.

func (*AUFSWhiteouts) HandleEntry

func (o *AUFSWhiteouts) HandleEntry(h *tar.Header) (bool, bool, error)

HandleEntry is the meat and potatoes of the filter; managing the overlay files.

func (*AUFSWhiteouts) SetTarWriter

func (o *AUFSWhiteouts) SetTarWriter(tw *tar.Writer) error

SetTarWriter sets the tar writer for output processing.

type Options

type Options struct {
	NoLchown bool
}

Options controls the behavior of some tarball related operations.

type OverlayWhiteouts

type OverlayWhiteouts struct {
	// contains filtered or unexported fields
}

OverlayWhiteouts is a TarFilter to handle overlay whiteout files.

func NewOverlayWhiteouts

func NewOverlayWhiteouts() *OverlayWhiteouts

NewOverlayWhiteouts creates a new overlay whiteout filter.

func (*OverlayWhiteouts) Close

func (o *OverlayWhiteouts) Close() error

Close closes the tar filter, finalizing any processing.

func (*OverlayWhiteouts) HandleEntry

func (o *OverlayWhiteouts) HandleEntry(h *tar.Header) (bool, bool, error)

HandleEntry is the meat and potatoes of the filter; managing the overlay files.

func (*OverlayWhiteouts) SetTarWriter

func (o *OverlayWhiteouts) SetTarWriter(tw *tar.Writer) error

SetTarWriter sets the tar writer for output processing.

type TarFilter

type TarFilter interface {
	SetTarWriter(tw *tar.Writer) error
	HandleEntry(*tar.Header) (bool, bool, error)
	Close() error
}

TarFilter implements a tar filtering interface for *tar.Reader processing.

Jump to

Keyboard shortcuts

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