Documentation
¶
Index ¶
Constants ¶
const ( // MatchLimit specifies the maximum number of positions tracked // for each unique key in the map of source data. See makeMap(). MatchLimit = 50 // MatchSize specifies the size of unique // chunks being searched for, in bytes. MatchSize = 9 )
const DebugIndex = false
Variables ¶
var ( // PL is fmt.Println() but is used only for debugging. PL = fmt.Println // TempBufferSize sets the size of memory buffers for reading files and other // streams. This memory is not fixed but allocated/released transiently. TempBufferSize = 32 * 1024 * 1024 // 32 MB )
var ( // DebugInfo when set, causes printing of messages helpful for debugging. DebugInfo = false // DebugTiming controls timing (benchmarking) of time spent in each function. DebugTiming = true // DebugWriteArgs when set, prints the arguments passed to write() DebugWriteArgs = false )
Functions ¶
func SetErrorFunc ¶
func SetErrorFunc(fn func(args ...interface{}) error)
SetErrorFunc changes the error-handling function, so that all errors in this package will be sent to this handler, which is useful for custom logging and mocking during unit tests. To restore the default error handler use SetErrorFunc(nil).
Types ¶
type Delta ¶
type Delta struct { // contains filtered or unexported fields } // Delta
Delta stores the binary delta difference between two byte arrays
func Load ¶
Load fills a new Delta structure from a byte array previously returned by Delta.Bytes().
func Make ¶
Make given two byte arrays 'a' and 'b', calculates the binary delta difference between the two arrays and returns it as a Delta. You can then use Delta.Apply() to generate 'b' from 'a' the Delta.
func (*Delta) Apply ¶
Apply uses the 'source' byte array, applies this Delta to it and returns the updated byte array. If this delta was not generated from source, returns an error.
func (*Delta) Bytes ¶
Bytes converts the Delta structure to a byte array (for serializing to a file, etc.)
func (*Delta) Dump ¶
func (ob *Delta) Dump()
Dump prints this object to the console in a human-friendly format.
func (Delta) GoString ¶
GoString returns a Go-syntax representation of the Delta structure. It implements the fmt.GoStringer interface.
func (*Delta) SourceSize ¶
SourceSize returns the size of the source byte array, in bytes.
func (*Delta) TargetSize ¶
TargetSize returns the size of the target byte array, in bytes.