Documentation
¶
Overview ¶
Package fsview builds an in-memory merged view of an image's layered filesystem. Layers are overlaid in manifest order with whiteout and opaque-directory semantics, so the resulting tree describes the final rootfs without writing anything to disk.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanEntryName ¶
CleanEntryName turns a raw tar entry name into a clean slash-separated path relative to the tree root, rejecting names that escape the root.
func IsDeviceKind ¶ added in v0.6.0
IsDeviceKind reports whether a kind is a device node or FIFO. These carry no content and cannot be recreated without privileges, so extraction paths skip them while listings still show them.
func NormalizePath ¶
NormalizePath converts a user-provided in-image path into a clean relative path: "" denotes the tree root itself.
Types ¶
type Node ¶
type Node struct {
Name string // base name inside the tree
Path string // slash-separated path relative to the tree root; empty for the root itself
EntryName string // original entry name in the layer tar that defined this node
Kind Kind
Size int64
Mode int64 // raw tar mode, permission bits plus special bits
ModTime time.Time
UID int
GID int
Uname string
Gname string
Linkname string // symlink target, or hardlink source path inside the tree
Layer string // archive entry name of the layer that last defined this node
Devmajor int64 // device major number, only meaningful for KindCharDev/KindBlockDev
Devminor int64 // device minor number, only meaningful for KindCharDev/KindBlockDev
Children []*Node
}
Node is a single entry in the merged filesystem view of an image.
func Build ¶
Build merges every layer in order into a single in-memory tree, applying whiteout and opaque-directory semantics the same way on-disk extraction does.
func BuildParsed ¶ added in v0.6.2
func BuildParsed(layerOrder []string, layers map[string]*ParsedLayer) (*Node, error)
BuildParsed merges pre-parsed layers in the given order. Semantics match Build: whiteouts, opaque directories and later-layer overrides apply the same way.
func (*Node) Resolve ¶
Resolve walks the tree following the given clean relative path and returns the matching node, or nil when any component does not exist. An empty or root path returns the tree root itself.
func (*Node) SortedChildren ¶
SortedChildren returns the children in byte-wise name order, like ls.
type ParsedLayer ¶ added in v0.6.2
type ParsedLayer struct {
// contains filtered or unexported fields
}
ParsedLayer holds one layer's tar headers in memory so the layer can be merged later. It exists for archives whose members cannot be re-read in manifest order: a single sequential pass parses every layer (a compressed archive is decompressed once), then the merge applies them in order.
func NewParsedLayer ¶ added in v0.7.0
func NewParsedLayer(headers []*tar.Header) *ParsedLayer
NewParsedLayer wraps headers that were parsed elsewhere — for instance from the header bytes a gzip index build captured while scanning — so they can be merged the same way a layer read from the archive would be.
func ParseLayer ¶ added in v0.6.2
func ParseLayer(r io.Reader) (*ParsedLayer, error)
ParseLayer reads all tar headers from r, discarding file data.
func (*ParsedLayer) HeaderCount ¶ added in v0.6.2
func (l *ParsedLayer) HeaderCount() int
HeaderCount reports how many tar entries the parsed layer holds; callers use it to bound how much is buffered.