fsdiff

package
v1.0.0-beta.22 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOverlayLayers

func GetOverlayLayers(m mount.Mount) ([]string, error)

func GetUpperdir

func GetUpperdir(lower, upper []mount.Mount) (string, error)

func IsOpaqueDir

func IsOpaqueDir(path string) (bool, error)

IsOpaqueDir reports whether the overlay layer directory at path is marked opaque, hiding everything beneath it in the layers below.

func IsOverlayMountType

func IsOverlayMountType(mnt mount.Mount) bool

func IsRedirectDir

func IsRedirectDir(path string) (bool, error)

IsRedirectDir reports whether the overlay layer directory at path redirects to another path in the layers below, which hold its inherited contents.

func VolatileIncompatDir

func VolatileIncompatDir(mnt mount.Mount) string

func VolatileIncompatDirs

func VolatileIncompatDirs(mounts []mount.Mount) []string

func WalkChanges

func WalkChanges(
	ctx context.Context,
	lowerRoot, upperRoot string,
	comparison Comparison,
	changeFn continuityfs.ChangeFunc,
) error

func WalkLayerDeltaChanges

func WalkLayerDeltaChanges(
	ctx context.Context,
	changeFn continuityfs.ChangeFunc,
	delta LayerDelta,
	upperView, lowerView string,
	comparison Comparison,
) error

WalkLayerDeltaChanges reports the changes from lowerView to upperView, the merged views of two snapshots that delta separates, in the order and with the semantics of a double walk of the two views (WalkChanges), but costing the size of delta's layers. A single upper layer above lower is WalkUpperdirChanges itself.

Every path in any of delta's layers is a candidate; each is classified by comparing the two merged views, so content a later layer reverts, or a whiteout a later layer refills, is no change. A deleted directory is reported once, without its contents, as is a directory replaced by a file. A directory opaque in any of the layers, or replaced in one (by a whiteout or a file) and made a directory again by a later one, hides the shared layers beneath it on one side, so it is diffed in full. A redirected directory is an error: the caller falls back to WalkChanges.

func WalkUpperdirChanges

func WalkUpperdirChanges(
	ctx context.Context,
	changeFn continuityfs.ChangeFunc,
	upperdir, upperdirView, base string,
	comparison Comparison,
) error

func WriteUpperdir

func WriteUpperdir(ctx context.Context, w io.Writer, upperdir string, lower []mount.Mount) error

Types

type Comparison

type Comparison uint8
const (
	CompareCompat Comparison = iota
	CompareContentOnMetadataMatch
	// CompareInodeThenContent treats files backed by the same inode as
	// unchanged and compares content whenever distinct files have otherwise
	// matching metadata. Snapshots of a shared lineage resolve unchanged
	// files to the same backing inode even across separate mounts, so this
	// stays O(changed files) there while still catching files whose stat
	// happens to collide (same size and mtime, different bytes).
	CompareInodeThenContent
	// CompareInodeOnly is a conservative, content-free variant for bounded
	// inspections. Distinct backing files always count as potentially changed,
	// even if all their metadata matches.
	CompareInodeOnly
)

type LayerDelta

type LayerDelta struct {
	// Lower are the layers only the lower snapshot has.
	Lower []string
	// Upper are the layers only the upper snapshot has.
	Upper []string
	// Same reports that both snapshots have exactly the same layers: their
	// trees are identical.
	Same bool
}

LayerDelta is what separates two overlay snapshots of one lineage: the layers each has above the layers they share, bottom first. Every difference between the two trees is recorded in those layers: on top of the same shared layers, a path can only differ where one side's own layers hold an entry for it.

func GetLayerDelta

func GetLayerDelta(lower, upper []mount.Mount) (LayerDelta, error)

GetLayerDelta returns the layers separating lower from upper, two snapshots that share their bottom layers: upper one or more operations above lower (GetUpperdir's case, generalized to several layers), or both built on a common ancestor, as two copy-on-write children of one snapshot are. It fails when they share no layer, or nothing separates them.

func (*LayerDelta) Empty

func (d *LayerDelta) Empty() bool

Empty reports whether there is nothing to go by: no layers to walk, nor the knowledge that there are none because both sides are the same.

Jump to

Keyboard shortcuts

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