diff

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BsdiffEngine

type BsdiffEngine struct{}

BsdiffEngine implements the DiffEngine interface using bsdiff

func NewBsdiffEngine

func NewBsdiffEngine() *BsdiffEngine

NewBsdiffEngine creates a new bsdiff-based diff engine

func (*BsdiffEngine) ApplyPatch

func (e *BsdiffEngine) ApplyPatch(baseData, patchData []byte) ([]byte, error)

ApplyPatch applies a bsdiff patch to base data

func (*BsdiffEngine) ComputeDiff

func (e *BsdiffEngine) ComputeDiff(oldData, newData []byte) ([]byte, error)

ComputeDiff computes a binary diff using bsdiff

func (*BsdiffEngine) Name

func (e *BsdiffEngine) Name() string

Name returns the name of the engine

type DiffEngine

type DiffEngine interface {
	// ComputeDiff computes the binary diff between old and new data
	ComputeDiff(oldData, newData []byte) ([]byte, error)

	// ApplyPatch applies a diff patch to base data to produce new data
	ApplyPatch(baseData, patchData []byte) ([]byte, error)

	// Name returns the name of the diff engine
	Name() string
}

DiffEngine defines the interface for binary diff operations

func NewDiffEngine

func NewDiffEngine(library string) (DiffEngine, error)

NewDiffEngine creates a new diff engine based on the specified library

type Stats

type Stats struct {
	OldSize         int     // Size of old data
	NewSize         int     // Size of new data
	PatchSize       int     // Size of patch data
	CompressionRate float64 // Patch size / new size (lower is better)
}

Stats holds statistics about a diff operation

func ComputeStats

func ComputeStats(oldData, newData, patchData []byte) Stats

ComputeStats calculates statistics for a diff operation

Jump to

Keyboard shortcuts

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