patch

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const PatchExpirationMargin = 10 * time.Second

PatchExpirationMargin is added to the HTTP expiration beyond ttl.

Variables

View Source
var ErrPatchSamePublishTime = fmt.Errorf("same publishTime in both MPDs")
View Source
var ErrPatchTooLate = fmt.Errorf("patch TTL exceeded")

Functions

func MPDDiff

func MPDDiff(mpdOld, mpdNew []byte) (doc *etree.Document, expiration time.Time, err error)

MPDDiff compares two MPDs and returns a patch document or an error.

Types

type Op

type Op struct {
	OpType OpType         // Insert or delete, as above
	OldPos int            // Position in the old list of item to be inserted or deleted
	NewPos int            // Position in the _new_ list of item to be inserted
	Elem   *etree.Element // Actual value to be inserted or deleted
}

func MyersDiff

func MyersDiff(e, f []*etree.Element, equals func(*etree.Element, *etree.Element) bool) []Op

MyersDiff creates a minimal list of differences between 2 lists e and f. Requires O(min(len(e),len(f))) space and O(min(len(e),len(f)) * D) worst-case execution time where D is the number of differences.

type OpType

type OpType int
const (
	OpDelete OpType = iota
	OpInsert
)

Jump to

Keyboard shortcuts

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