xfile

package
v0.0.0-...-b927f55 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WhiteoutPrefix is the prefix for whiteout file.
	// See https://github.com/opencontainers/image-spec/blob/main/layer.md#whiteouts
	WhiteoutPrefix = ".wh."
	// OpaqueWhiteout is the opaque whiteout file.
	// See https://github.com/opencontainers/image-spec/blob/main/layer.md#opaque-whiteout
	OpaqueWhiteout = WhiteoutPrefix + WhiteoutPrefix + ".opq"
	// PathSeparator is the string alias of os.PathSeparator
	PathSeparator = string(os.PathSeparator)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Path

type Path string

Path represents a file path

func (Path) AllPaths

func (p Path) AllPaths() []Path

AllPaths returns all constituent paths of the current path + the current path itself (e.g. /home/wagoodman/file.txt -> /, /home, /home/wagoodman, /home/wagoodman/file.txt )

func (Path) Basename

func (p Path) Basename() string

Basename of the path (i.e. filename)

func (Path) ConstituentPaths

func (p Path) ConstituentPaths() []Path

ConstituentPaths returns all constituent paths for the current path (not including the current path itself) (e.g. /home/wagoodman/file.txt -> /, /home, /home/wagoodman )

func (Path) IsAbsolutePath

func (p Path) IsAbsolutePath() bool

IsAbsolutePath returns true if the path is an absolute path.

func (Path) IsDirWhiteout

func (p Path) IsDirWhiteout() bool

IsDirWhiteout indicates if the path has a basename is a opaque whiteout (which means all parent directory contents should be ignored during squashing)

func (Path) IsFileWhiteout

func (p Path) IsFileWhiteout() bool

IsFileWhiteout indicates if the file basename has a whiteout prefix, except a directory (which means that the file should be removed during squashing)

func (Path) IsWhiteout

func (p Path) IsWhiteout() bool

IsWhiteout indicates if the file basename has a whiteout prefix (which means that the file should be removed during squashing)

func (Path) Normalize

func (p Path) Normalize() Path

Normalize returns the cleaned file path representation (trimmed of spaces and resolve relative notations)

func (Path) ParentPath

func (p Path) ParentPath() (Path, error)

ParentPath returns a path object to the current files parent directory (or errors out if there is no parent)

func (Path) UnWhiteoutPath

func (p Path) UnWhiteoutPath() (Path, error)

UnWhiteoutPath is a representation of the current path with no whiteout prefixes

type PathSet

type PathSet map[Path]struct{}

PathSet is a set of paths.

func NewPathSet

func NewPathSet() PathSet

NewPathSet returns a new PathSet.

func (PathSet) Add

func (s PathSet) Add(i Path)

Add adds a path to the set.

func (PathSet) Contains

func (s PathSet) Contains(i Path) bool

Contains returns true if the set contains the path.

func (PathSet) Remove

func (s PathSet) Remove(i Path)

Remove removes a path from the set.

type PathStack

type PathStack []Path

PathStack is a stack of paths.

func (*PathStack) Pop

func (s *PathStack) Pop() Path

Pop returns the top path in the stack.

func (*PathStack) Push

func (s *PathStack) Push(n Path)

Push adds a path to the stack.

func (*PathStack) Size

func (s *PathStack) Size() int

Size returns the length of the stack.

type Paths

type Paths []Path

Paths is a list of paths implementing sort.Interface.

func (Paths) Len

func (p Paths) Len() int

func (Paths) Less

func (p Paths) Less(i, j int) bool

func (Paths) Swap

func (p Paths) Swap(i, j int)

Jump to

Keyboard shortcuts

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