kdiff

package
v0.0.0-...-b60f976 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddBytes

type AddBytes struct {
	Data []byte
}

func (*AddBytes) Patch

func (m *AddBytes) Patch(baseData []byte, dst io.Writer) error

type Base

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

func NewBase

func NewBase(data []byte) *Base

Creates new base which will be used for diff

type Diff

type Diff struct {
	// Base file size for quick validation.
	Size int
	// New file hash for validation.
	CheckSum []byte
	// Operations for patching.
	Operations []Operation
}

Holds information about differences between two datasets. Diff is used for patching. All fields are exported so anyone can implement their own serialization format.

func DiffBytes

func DiffBytes(base *Base, data []byte) (*Diff, error)

func DiffReader

func DiffReader(base *Base, newData io.Reader, bufferSize uint32) (*Diff, error)

func Unmarshal

func Unmarshal(raw []byte) (*Diff, error)

func (*Diff) Marshal

func (d *Diff) Marshal() ([]byte, error)

Marshals diff into byte array using protobufs.

func (*Diff) Patch

func (d *Diff) Patch(baseData []byte, dst io.Writer) error

type Operation

type Operation interface {
	Patch(baseData []byte, dst io.Writer) error
}

type Reference

type Reference struct {
	Start int
	End   int
}

func (*Reference) Patch

func (s *Reference) Patch(baseData []byte, dst io.Writer) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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