rediff

package
v0.0.0-...-189a019 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRediffSizeLimit = 4 * 1024 * 1024 * 1024 // 4GB

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	GetTargetContainer() *tlc.Container
	GetSourceContainer() *tlc.Container
	GetDiffMappings() DiffMappings
	Partitions() int
	Optimize(params OptimizeParams) error
}

func NewContext

func NewContext(params Params) (Context, error)

NewContext initializes the diffing process, it also analyzes the patch to find diff mapping so that it's ready for optimization

type DiffMapping

type DiffMapping struct {
	TargetIndex int64
	NumBytes    int64
}

A DiffMapping is a pair of files that have similar contents (blocks in common) or equal paths, and which are good candidates for bsdiffing

type DiffMappings

type DiffMappings map[int64]*DiffMapping

DiffMappings contains one diff mapping for each pair of files to be bsdiff'd

func (DiffMappings) ToString

func (dm DiffMappings) ToString(sourceContainer tlc.Container, targetContainer tlc.Container) string

ToString returns a human-readable representation of all diff mappings, which gives an overview of how files changed.

type FileOrigin

type FileOrigin map[int64]int64

FileOrigin maps a target's file index to how many bytes it contribute to a given source file

type OptimizeParams

type OptimizeParams struct {
	TargetPool lake.Pool
	SourcePool lake.Pool

	PatchWriter io.Writer
}

type Params

type Params struct {
	// PatchReader is a source used twice: to find diff mappings, and then again
	// to copy rsync operations for files that we won't optimize.
	// rediff.Context is in charge of resuming, since it uses it twice.
	PatchReader savior.SeekSource

	// RediffSizeLimit (optional) is the maximum size of a file we'll attempt to rediff.
	// If a file is larger than that, ops will just be copied.
	RediffSizeLimit int64

	// optional
	SuffixSortConcurrency int
	// optional
	Partitions int
	// optional
	Compression *pwr.CompressionSettings
	// optional
	Consumer *state.Consumer
	// optional
	BsdiffStats *bsdiff.DiffStats
	// optional
	ForceMapAll bool
	// optional
	MeasureMem bool
}

Jump to

Keyboard shortcuts

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