Documentation ¶
Overview ¶
RSync/RDiff implementation.
Algorithm found at: http://www.samba.org/~tridge/phd_thesis.pdf
Definitions
Source: The final content. Target: The content to be made into final content. Signature: The sequence of hashes used to identify the content.
Index ¶
- Constants
- type BlockHash
- type OpType
- type Operation
- type OperationWriter
- type RSync
- func (r *RSync) ApplyDelta(alignedTarget io.Writer, target io.ReadSeeker, ops chan Operation, ...) error
- func (r *RSync) BlockHashCount(targetLength int) (count int)
- func (r *RSync) CreateDelta(source io.Reader, signature []BlockHash, ops OperationWriter, ...) (err error)
- func (r *RSync) CreateSignature(target io.Reader, sw SignatureWriter) error
- type SignatureWriter
Constants ¶
const DefaultBlockSize = 1024 * 6
If no BlockSize is specified in the RSync instance, this value is used.
const DefaultMaxDataOp = DefaultBlockSize * 10
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OperationWriter ¶
type RSync ¶
type RSync struct { BlockSize int MaxDataOp int // If this is nil an MD5 hash is used. UniqueHasher hash.Hash // contains filtered or unexported fields }
Properties to use while working with the rsync algorithm. A single RSync should not be used concurrently as it may contain internal buffers and hash sums.
func (*RSync) ApplyDelta ¶
func (r *RSync) ApplyDelta(alignedTarget io.Writer, target io.ReadSeeker, ops chan Operation, alignedTargetSum hash.Hash) error
Apply the difference to the target. If alignedTargetSum is present the alignedTarget content will be written to it.
func (*RSync) BlockHashCount ¶
If the target length is known the number of hashes in the signature can be determined.
func (*RSync) CreateDelta ¶
func (r *RSync) CreateDelta(source io.Reader, signature []BlockHash, ops OperationWriter, sourceSum hash.Hash) (err error)
Create the operation list to mutate the target signature into the source. Any data operation from the OperationWriter must have the data copied out within the span of the function; the data buffer underlying the operation data is reused. The sourceSum create a complete hash sum of the source if present.
func (*RSync) CreateSignature ¶
func (r *RSync) CreateSignature(target io.Reader, sw SignatureWriter) error
Calculate the signature of target.
type SignatureWriter ¶
Write signatures as they are generated.