spec: github.com/appc/spec/aci Index | Files

package aci

import "github.com/appc/spec/aci"

Package aci contains various functions for working with App Container Images.

Index

Package Files

build.go doc.go file.go layout.go writer.go

Constants

const (
    TypeGzip    = FileType("gz")
    TypeBzip2   = FileType("bz2")
    TypeXz      = FileType("xz")
    TypeTar     = FileType("tar")
    TypeText    = FileType("text")
    TypeUnknown = FileType("unknown")
)
const (
    // Path to manifest file inside the layout
    ManifestFile = "manifest"
    // Path to rootfs directory inside the layout
    RootfsDir = "rootfs"
)

Variables

var (
    ErrNoRootFS   = errors.New("no rootfs found in layout")
    ErrNoManifest = errors.New("no image manifest found in layout")
)

func BuildWalker Uses

func BuildWalker(root string, aw ArchiveWriter, cb TarHeaderWalkFunc) filepath.WalkFunc

BuildWalker creates a filepath.WalkFunc that walks over the given root (which should represent an ACI layout on disk) and adds the files in the rootfs/ subdirectory to the given ArchiveWriter

func ManifestFromImage Uses

func ManifestFromImage(rs io.ReadSeeker) (*schema.ImageManifest, error)

ManifestFromImage extracts a new schema.ImageManifest from the given ACI image.

func NewCompressedReader Uses

func NewCompressedReader(rs io.ReadSeeker) (io.ReadCloser, error)

NewCompressedReader creates a new io.ReaderCloser from the given ACI image. It is the caller's responsibility to call Close on the Reader when done.

func ValidateArchive Uses

func ValidateArchive(tr *tar.Reader) error

ValidateArchive takes a *tar.Reader and validates that the layout of the filesystem the reader encapsulates matches that expected by the Application Container Image format. If any errors are encountered during the validation, it will abort and return the first one.

func ValidateLayout Uses

func ValidateLayout(dir string) error

ValidateLayout takes a directory and validates that the layout of the directory matches that expected by the Application Container Image format. If any errors are encountered during the validation, it will abort and return the first one.

type ArchiveWriter Uses

type ArchiveWriter interface {
    AddFile(hdr *tar.Header, r io.Reader) error
    Close() error
}

ArchiveWriter writes App Container Images. Users wanting to create an ACI or should create an ArchiveWriter and add files to it; the ACI will be written to the underlying tar.Writer

func NewImageWriter Uses

func NewImageWriter(am schema.ImageManifest, w *tar.Writer) ArchiveWriter

NewImageWriter creates a new ArchiveWriter which will generate an App Container Image based on the given manifest and write it to the given tar.Writer

type ErrOldVersion Uses

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

func (ErrOldVersion) Error Uses

func (e ErrOldVersion) Error() string

type FileType Uses

type FileType string

func DetectFileType Uses

func DetectFileType(r io.Reader) (FileType, error)

DetectFileType attempts to detect the type of file that the given reader represents by comparing it against known file signatures (magic numbers)

type TarHeaderWalkFunc Uses

type TarHeaderWalkFunc func(hdr *tar.Header) bool

TarHeaderWalkFunc is the type of the function which allows setting tar headers or filtering out tar entries when building an ACI. It will be applied to every entry in the tar file.

If true is returned, the entry will be included in the final ACI; if false, the entry will not be included.

type TarReadCloser Uses

type TarReadCloser struct {
    *tar.Reader
    io.Closer
}

TarReadCloser embeds a *tar.Reader and the related io.Closer It is the caller's responsibility to call Close on TarReadCloser when done.

func NewCompressedTarReader Uses

func NewCompressedTarReader(rs io.ReadSeeker) (*TarReadCloser, error)

NewCompressedTarReader creates a new TarReadCloser reading from the given ACI image. It is the caller's responsibility to call Close on the TarReadCloser when done.

func (*TarReadCloser) Close Uses

func (r *TarReadCloser) Close() error

type XzReader Uses

type XzReader struct {
    io.ReadCloser
    // contains filtered or unexported fields
}

XzReader is an io.ReadCloser which decompresses xz compressed data.

func NewXzReader Uses

func NewXzReader(r io.Reader) (*XzReader, error)

NewXzReader shells out to a command line xz executable (if available) to decompress the given io.Reader using the xz compression format and returns an *XzReader. It is the caller's responsibility to call Close on the XzReader when done.

func (*XzReader) Close Uses

func (r *XzReader) Close() error

Package aci imports 20 packages (graph) and is imported by 225 packages. Updated 2017-09-27. Refresh now. Tools for package owners.