tardiff

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package tardiff provides functionality for analyzing and creating binary differences between tar archives.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(oldTarFiles []io.ReadSeeker, newTarFile io.ReadSeeker, diffFile io.Writer, options *Options) error

Diff creates a binary difference between a set of tar archives and a new tar archive. oldTarFiles contains one or more old tar files, in extraction order.

func DiffWithSources added in v0.5.0

func DiffWithSources(sources *SourceAnalysis, oldTarFiles []io.ReadSeeker, newTarFile io.ReadSeeker, diffFile io.Writer, options *Options) error

DiffWithSources creates a binary difference using a pre-computed SourceAnalysis. The oldTarFiles must correspond to the same tar files (in the same order) that were passed to AnalyzeSources. If they are independent readers then that allows concurrent calls from multiple goroutines.

Types

type Options

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

Options configures the behavior of the diff operation.

func NewOptions

func NewOptions() *Options

NewOptions creates a new Options struct with default values.

func (*Options) SetApplyWhiteouts added in v0.5.0

func (o *Options) SetApplyWhiteouts(apply bool)

SetApplyWhiteouts enables docker/OCI-style whiteout processing when analyzing old tar layers. Whiteout files (.wh.<name> and .wh..wh..opq) in upper layers remove matching paths from lower layers, so the delta sources reflect the merged container image rather than individual layers.

func (*Options) SetCompressionLevel

func (o *Options) SetCompressionLevel(compressionLevel int)

SetCompressionLevel sets the compression level for the output diff file.

func (*Options) SetIgnoreSourcePrefixes added in v0.5.0

func (o *Options) SetIgnoreSourcePrefixes(prefixes []string)

SetIgnoreSourcePrefixes sets path prefixes to exclude from delta sources. Files whose paths all match one of these prefixes will not be used as delta sources. If a file has multiple names (hardlinks), any non-ignored name makes the file usable.

func (*Options) SetMaxBsdiffFileSize

func (o *Options) SetMaxBsdiffFileSize(maxBsdiffSize int64)

SetMaxBsdiffFileSize sets the maximum file size for bsdiff operations.

func (*Options) SetSourcePrefixes added in v0.4.0

func (o *Options) SetSourcePrefixes(prefixes []string)

SetSourcePrefixes sets path prefixes to filter which source files can be used for delta. Only files whose primary path starts with one of these prefixes will be used as delta sources.

func (*Options) SetTmpDir added in v0.5.0

func (o *Options) SetTmpDir(dir string)

SetTmpDir sets the directory for temporary files. Defaults to os.TempDir().

type SourceAnalysis added in v0.5.0

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

SourceAnalysis contains information about pre-analyzed delta sources. It can be reused across multiple DiffWithSources calls, including concurrent calls from different goroutines, as long as each call provides its own independent set of old tar readers.

func AnalyzeSources added in v0.5.0

func AnalyzeSources(oldTarFiles []io.ReadSeeker, options *Options) (*SourceAnalysis, error)

AnalyzeSources pre-computes analysis of one or more old tar files that can be reused across multiple DiffWithSources operations. oldTarFiles contains one or more old tar files, in extraction order. The readers are only used during this call and are not retained.

Jump to

Keyboard shortcuts

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