fs

package
v0.7.1-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: Apache-2.0 Imports: 17 Imported by: 7

Documentation

Index

Constants

View Source
const (
	AttrsHash    AttrSet = 1
	AttrsMtime   AttrSet = 2
	AttrsAtime   AttrSet = 4
	AttrsAll             = AttrsHash | AttrsMtime | AttrsAtime
	AttrsCompare         = AttrsHash | AttrsMtime
	TimeFormat           = time.RFC3339
)
View Source
const WhiteoutPrefix = ".wh."

TODO: also support opaque whiteout (.wh..wh..opq): https://github.com/opencontainers/image-spec/blob/master/layer.md#opaque-whiteout

Variables

This section is empty.

Functions

func NewFileReader

func NewFileReader(file string, fsEval fseval.FsEval) *fileReader

Types

type AttrMapper

type AttrMapper interface {
	ToContainer(a *FileAttrs) error
	ToHost(a *FileAttrs) error
}

func NewAttrMapper

func NewAttrMapper(idMap idutils.IdMappings) AttrMapper

func NewRootlessAttrMapper

func NewRootlessAttrMapper(idMap idutils.IdMappings) AttrMapper

type AttrSet

type AttrSet uint

type DerivedAttrs

type DerivedAttrs struct {
	Hash     string
	URL      string
	HTTPInfo string
}

func (*DerivedAttrs) Equal

func (s *DerivedAttrs) Equal(o *DerivedAttrs) bool

type DeviceAttrs

type DeviceAttrs struct {
	FileAttrs
	Devmajor int64
	Devminor int64
}

type ExpandingWriter

type ExpandingWriter struct {
	Writer
}

Writer that expands lazy resources

func (*ExpandingWriter) Lazy

func (w *ExpandingWriter) Lazy(path, name string, src LazySource, written map[Source]string) (err error)

type FSOptions

type FSOptions struct {
	Rootless   bool
	IdMappings idutils.IdMappings
	FsEval     fseval.FsEval
}

func NewFSOptions

func NewFSOptions(rootless bool) FSOptions

type FileAttrs

type FileAttrs struct {
	Mode os.FileMode
	idutils.UserIds
	Xattrs map[string]string
	FileTimes
	Size    int64
	Symlink string
}

func (*FileAttrs) AttrString

func (a *FileAttrs) AttrString(attrs AttrSet) string

func (*FileAttrs) Equal

func (a *FileAttrs) Equal(o *FileAttrs) bool

type FileInfo

type FileInfo struct {
	*FileAttrs
	// contains filtered or unexported fields
}

func NewFileInfo

func NewFileInfo(name string, attrs *FileAttrs) *FileInfo

func (*FileInfo) IsDir

func (fi *FileInfo) IsDir() bool

func (*FileInfo) ModTime

func (fi *FileInfo) ModTime() time.Time

func (*FileInfo) Mode

func (fi *FileInfo) Mode() os.FileMode

func (*FileInfo) Name

func (fi *FileInfo) Name() string

func (*FileInfo) Size

func (fi *FileInfo) Size() int64

func (*FileInfo) Sys

func (fi *FileInfo) Sys() interface{}

type FileSource

type FileSource interface {
	Source
	Readable
	HashIfAvailable() string
}

type FileTimes

type FileTimes struct {
	Atime time.Time
	Mtime time.Time
}

type FsNode

type FsNode interface {
	Name() string
	Path() string
	Empty() bool
	SetSource(src Source)
	Node(path string) (FsNode, error)
	Mkdirs(path string) (FsNode, error)
	Link(path, targetPath string) (FsNode, FsNode, error)
	AddUpper(path string, src Source) (FsNode, error)
	AddLower(path string, src Source) (FsNode, error)
	AddWhiteout(path string) (FsNode, error)
	Remove()
	MockDevices()
	Normalized() (FsNode, error)
	WriteTo(w io.Writer, attrs AttrSet) error
	Write(Writer) error
	Diff(FsNode) (FsNode, error)
	Hash(AttrSet) (digest.Digest, error)
}

type LazySource

type LazySource interface {
	Source
	Expand(dest string, w Writer, written map[Source]string) error
}

type NodeAttrs

type NodeAttrs struct {
	NodeInfo
	DerivedAttrs
}

func ParseNodeAttrs

func ParseNodeAttrs(s string) (r NodeAttrs, err error)

func (*NodeAttrs) AttrString

func (a *NodeAttrs) AttrString(attrs AttrSet) string

func (*NodeAttrs) Attrs

func (s *NodeAttrs) Attrs() NodeInfo

func (*NodeAttrs) DeriveAttrs

func (s *NodeAttrs) DeriveAttrs() (DerivedAttrs, error)

func (*NodeAttrs) String

func (a *NodeAttrs) String() string

func (*NodeAttrs) Write

func (s *NodeAttrs) Write(path, name string, w Writer, written map[Source]string) (err error)

type NodeInfo

type NodeInfo struct {
	NodeType NodeType
	FileAttrs
}

func (*NodeInfo) AttrString

func (a *NodeInfo) AttrString(attrs AttrSet) string

func (NodeInfo) Equal

func (s NodeInfo) Equal(o NodeInfo) bool

type NodeType

type NodeType string
var (
	TypeFile     NodeType = "file"
	TypeDir      NodeType = "dir"
	TypeOverlay  NodeType = "overlay"
	TypeSymlink  NodeType = "symlink"
	TypeFifo     NodeType = "fifo"
	TypeDevice   NodeType = "dev"
	TypeWhiteout NodeType = "whiteout"
)

type Readable

type Readable interface {
	Reader() (io.ReadCloser, error)
}

func NewReadable

func NewReadable(r io.Reader) Readable

func NewReadableBytes

func NewReadableBytes(b []byte) Readable

type Source

type Source interface {
	// TODO: a) Replace with CalcDerivedAttrs() and Attrs() returning pointer to all attrs?!
	//          or at least let DerivedAttrs() return only derived attrs without normal attrs
	Attrs() NodeInfo
	DeriveAttrs() (DerivedAttrs, error)
	Write(dest, name string, w Writer, written map[Source]string) error
}

type Writer

type Writer interface {
	Lazy(path, name string, src LazySource, written map[Source]string) error
	File(path string, src FileSource) (Source, error)
	Link(path, target string) error
	Symlink(path string, attrs FileAttrs) error
	Dir(path, base string, attrs FileAttrs) error
	Mkdir(path string) error
	Fifo(path string, attrs DeviceAttrs) error
	Device(path string, attrs DeviceAttrs) error
	Remove(path string) error
	LowerNode(path, name string, a *NodeAttrs) error
	LowerLink(path, target string, a *NodeAttrs) error
	Parent() error
}

func HashingNilWriter

func HashingNilWriter() Writer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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