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 )
Variables ¶
var ( // DebugInfo when set, causes printing of messages helpful for debugging. DebugInfo = false // DebugTiming controls timing (benchmarking) of time spent in each function. DebugTiming = false // DebugWriteArgs when set, prints the arguments passed to write() DebugWriteArgs = false )
var TempBufferSize = 16 * 1024 * 1024 // 32 MB
Functions ¶
func GetBufPool ¶ added in v1.0.0
GetBufPool Get calls Get on the default Pool.
func PutBufPool ¶ added in v1.0.0
PutBufPool Put calls Put on the default Pool.
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 (*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.
type Pool ¶ added in v1.0.0
type Pool struct { // MaxCap defines the maximum capacity accepted for recycled buffer. // If Put() is called with a buffer larger than this value, it's discarded. // See https://github.com/golang/go/issues/23199 . // 0 means there is no maximum capacity. MaxCap int // contains filtered or unexported fields }
Pool is a pool of *bytes.Buffer.