{"modulePath":"github.com/wavetermdev/waveterm/waveshell","version":"v0.7.6","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package statediff\n\n## Constants\n\n```go\nconst LineDiffVersion = 1\n```\n\n```go\nconst LineDiffVersion_0 = 0\n```\n\n```go\nconst MapDiffVersion = 1\n```\n\n```go\nconst MapDiffVersion_0 = 0\n```\n\n## Functions\n\n```go\nfunc ApplyLineDiff(str1 string, diffBytes []byte) (string, error)\n```\n\n```go\nfunc ApplyMapDiff(oldMap map[string][]byte, diffBytes []byte) (map[string][]byte, error)\n```\n\n```go\nfunc MakeLineDiff(str1 string, str2 string, splitString string) []byte\n```\n\n```go\nfunc MakeMapDiff(m1 map[string][]byte, m2 map[string][]byte) []byte\n```\n\n## Types\n\n```go\ntype LineDiffType struct {\n\tVersion     int\n\tSplitString string // added in version 1\n\tLines       []SingleLineEntry\n\tNewData     []string\n}\n```\n\n```go\nfunc (diff *LineDiffType) Clear()\n```\n\n```go\nfunc (rtn *LineDiffType) Decode(diffBytes []byte) error\n```\n\n```go\nfunc (rtn *LineDiffType) Decode_v0(diffBytes []byte) error\n```\n\n```go\nfunc (diff LineDiffType) Dump()\n```\n\n```go\nfunc (diff LineDiffType) Encode() []byte\n```\nversion 1 updates the diff to include the split-string it also encodes all the strings with run-length encoding\n\n```go\nfunc (diff LineDiffType) Encode_v0() []byte\n```\nversion 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)\n\n```go\ntype MapDiffType struct {\n\tToAdd    map[string][]byte\n\tToRemove []string\n}\n```\n\n```go\nfunc (diff *MapDiffType) Clear()\n```\n\n```go\nfunc (diff *MapDiffType) Decode(diffBytes []byte) error\n```\n\n```go\nfunc (diff *MapDiffType) Decode_v0(diffBytes []byte) error\n```\n\n```go\nfunc (diff MapDiffType) Dump()\n```\n\n```go\nfunc (diff MapDiffType) Encode() []byte\n```\nwe sort map keys and remove values to make the diff deterministic\n\n```go\nfunc (diff MapDiffType) Encode_v0() []byte\n```\nthis is kept for reference\n\n```go\ntype SingleLineEntry struct {\n\tLineVal int\n\tRun     int\n}\n```\n\n","path":"github.com/wavetermdev/waveterm/waveshell/pkg/statediff","name":"statediff","synopsis":"","isRedistributable":true}
