statediff

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2024 License: Apache-2.0 Imports: 7 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const LineDiffVersion = 1
View Source
const LineDiffVersion_0 = 0
View Source
const MapDiffVersion = 1
View Source
const MapDiffVersion_0 = 0

Variables

This section is empty.

Functions

func ApplyLineDiff

func ApplyLineDiff(str1 string, diffBytes []byte) (string, error)

func ApplyMapDiff

func ApplyMapDiff(oldMap map[string][]byte, diffBytes []byte) (map[string][]byte, error)

func MakeLineDiff

func MakeLineDiff(str1 string, str2 string, splitString string) []byte

func MakeMapDiff

func MakeMapDiff(m1 map[string][]byte, m2 map[string][]byte) []byte

Types

type LineDiffType

type LineDiffType struct {
	Version     int
	SplitString string // added in version 1
	Lines       []SingleLineEntry
	NewData     []string
}

func (*LineDiffType) Clear

func (diff *LineDiffType) Clear()

func (*LineDiffType) Decode

func (rtn *LineDiffType) Decode(diffBytes []byte) error

func (*LineDiffType) Decode_v0

func (rtn *LineDiffType) Decode_v0(diffBytes []byte) error

func (LineDiffType) Dump

func (diff LineDiffType) Dump()

func (LineDiffType) Encode

func (diff LineDiffType) Encode() []byte

version 1 updates the diff to include the split-string it also encodes all the strings with run-length encoding

func (LineDiffType) Encode_v0

func (diff LineDiffType) Encode_v0() []byte

version 0 is no longer used, but kept here as a reference for decoding simple encoding write varints. first version, then then len, then len-number-of-varints, then fill the rest with newdata [version] [len-varint] [varint]xlen... newdata (bytes)

type MapDiffType

type MapDiffType struct {
	ToAdd    map[string][]byte
	ToRemove []string
}

func (*MapDiffType) Clear

func (diff *MapDiffType) Clear()

func (*MapDiffType) Decode

func (diff *MapDiffType) Decode(diffBytes []byte) error

func (*MapDiffType) Decode_v0

func (diff *MapDiffType) Decode_v0(diffBytes []byte) error

func (MapDiffType) Dump

func (diff MapDiffType) Dump()

func (MapDiffType) Encode

func (diff MapDiffType) Encode() []byte

we sort map keys and remove values to make the diff deterministic

func (MapDiffType) Encode_v0

func (diff MapDiffType) Encode_v0() []byte

this is kept for reference

type SingleLineEntry

type SingleLineEntry struct {
	LineVal int
	Run     int
}

Jump to

Keyboard shortcuts

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