util

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSameFile

func CheckSameFile(f1name, f2name string) (bool, error)
func CheckSameSymlink(f1name, f2name string) (bool, error)

func CheckTar

func CheckTar(image string) bool

func CleanFilePath added in v0.15.0

func CleanFilePath(dirtyPath string) string

CleanFilePath removes characters from a given path that cannot be used in paths by the underlying platform (e.g. Windows)

func CleanupImage

func CleanupImage(image Image)

func DirIsEmpty added in v0.10.0

func DirIsEmpty(path string) (bool, error)

given a path to a directory, check if it has any contents

func GetFileContents added in v0.5.1

func GetFileContents(path string) (*string, error)

GetFileContents returns the contents of a file at the specified path

func GetFileSystemForImage added in v0.10.0

func GetFileSystemForImage(image v1.Image, root string, whitelist []string) error

unpack image filesystem to local disk if provided directory is not empty, do nothing

func GetFileSystemForLayer added in v0.10.0

func GetFileSystemForLayer(layer v1.Layer, root string, whitelist []string) error

GetFileSystemForLayer unpacks a layer to local disk

func GetImageLayers

func GetImageLayers(pathToImage string) []string

func GetSize

func GetSize(path string) int64

func HasFilepathPrefix added in v0.7.0

func HasFilepathPrefix(path, prefix string) bool

HasFilepathPrefix checks if the given file path begins with prefix

func HasTag added in v0.8.0

func HasTag(image string) bool

checks to see if an image string contains a tag.

func IsTar

func IsTar(path string) bool

func RemoveTag added in v0.10.0

func RemoveTag(image string) string

returns a raw image name with the tag removed

func SortMap added in v0.10.0

func SortMap(m map[string]string) string

Types

type Directory

type Directory struct {
	Root    string
	Content []string
}

Directory stores a representation of a file directory.

func GetDirectory

func GetDirectory(path string, deep bool) (Directory, error)

GetDirectoryContents converts the directory starting at the provided path into a Directory struct.

type DirectoryEntry

type DirectoryEntry struct {
	Name string
	Size int64
}

func CreateDirectoryEntries

func CreateDirectoryEntries(root string, entryNames []string) (entries []DirectoryEntry)

func GetDirectoryEntries

func GetDirectoryEntries(d Directory) []DirectoryEntry

type Image

type Image struct {
	Image  v1.Image
	Source string
	FSPath string
	Digest v1.Hash
	Layers []Layer
}

func GetImage added in v0.14.0

func GetImage(imageName string, includeLayers bool, cacheDir string) (Image, error)

GetImage infers the source of an image and retrieves a v1.Image reference to it. Once a reference is obtained, it attempts to unpack the v1.Image's reader's contents into a temp directory on the local filesystem.

func GetImageForName added in v0.14.0

func GetImageForName(imageName string) (Image, error)

GetImageForName retrieves an image by name alone. It does not return layer information, or respect caching.

type ImageHistoryItem

type ImageHistoryItem struct {
	CreatedBy string `json:"created_by"`
}

type Layer added in v0.10.0

type Layer struct {
	FSPath string
	Digest v1.Hash
}

type OriginalPerm added in v0.9.0

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

type TestImage added in v0.10.0

type TestImage struct {
	Config *v1.ConfigFile
}

func (*TestImage) BlobSet added in v0.10.0

func (i *TestImage) BlobSet() (map[v1.Hash]struct{}, error)

func (*TestImage) ConfigFile added in v0.10.0

func (i *TestImage) ConfigFile() (*v1.ConfigFile, error)

func (*TestImage) ConfigName added in v0.10.0

func (i *TestImage) ConfigName() (v1.Hash, error)

func (*TestImage) Digest added in v0.10.0

func (i *TestImage) Digest() (v1.Hash, error)

func (*TestImage) LayerByDiffID added in v0.10.0

func (i *TestImage) LayerByDiffID(diffID v1.Hash) (v1.Layer, error)

func (*TestImage) LayerByDigest added in v0.10.0

func (i *TestImage) LayerByDigest(v1.Hash) (v1.Layer, error)

func (*TestImage) Layers added in v0.10.0

func (i *TestImage) Layers() ([]v1.Layer, error)

func (*TestImage) Manifest added in v0.10.0

func (i *TestImage) Manifest() (*v1.Manifest, error)

func (*TestImage) MediaType added in v0.10.0

func (i *TestImage) MediaType() (types.MediaType, error)

func (*TestImage) RawConfigFile added in v0.10.0

func (i *TestImage) RawConfigFile() ([]byte, error)

func (*TestImage) RawManifest added in v0.10.0

func (i *TestImage) RawManifest() ([]byte, error)

Jump to

Keyboard shortcuts

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