Documentation
¶
Overview ¶
Algorithm found at: https://rsync.samba.org/tech_report/tech_report.html Code in this file is inspired by: https://github.com/jbreiding/rsync-go
Definitions
Source: The final content. Target: The content to be made into final content. Signature: The sequence of hashes used to identify the content.
First create a patcher with: p = NewPatcher() Create a signature for the file you want to update using p.CreateSignatureIterator(file_to_update) Now create a Differ with the created signature d = NewDiffer() d.AddSignatureData(signature_data_from_previous_step) Now create a delta based on the signature and the reference file d.CreateDelta(reference_file) Finally, apply this delta using the patcher to produce a file identical to reference_file based ont he delta data and file_to_update p.StartDelta(output_file, file_to_update) p.UpdateDelta(...) p.FinishDelta()
Index ¶
Constants ¶
const BlockHashSize = 20
const DataSizeMultiple int = 8
const DefaultBlockSize = 1024 * 6
If no BlockSize is specified in the rsync instance, this value is used.
const MaxBlockSize int = 1024 * 1024 // sqrt of 1TB
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct {
Checksum_type ChecksumType
Strong_hash_type StrongHashType
Weak_hash_type WeakHashType
// contains filtered or unexported fields
}
type BlockHash ¶
Signature hash item generated from target.
func (*BlockHash) Unserialize ¶
type Differ ¶
type Differ struct {
Api
// contains filtered or unexported fields
}
func NewDiffer ¶
func NewDiffer() *Differ
Use to calculate a delta based on a supplied signature, via AddSignatureData
func (*Differ) AddSignatureData ¶
Add more external signature data
func (*Differ) CreateDelta ¶
Create a serialized delta based on the previously loaded signature
func (*Differ) FinishSignatureData ¶
type GrowBufferFunction ¶
type OperationWriter ¶
type OperationWriter struct {
Operations []Operation
// contains filtered or unexported fields
}
type Patcher ¶
type Patcher struct {
Api
// contains filtered or unexported fields
}
func NewPatcher ¶
Use to create a signature and possibly apply a delta
func (*Patcher) CreateSignatureIterator ¶
Create a signature for the data source in src.
func (*Patcher) FinishDelta ¶
Finish applying delta data
func (*Patcher) StartDelta ¶
func (self *Patcher) StartDelta(delta_output io.Writer, delta_input io.ReadSeeker)
Start applying serialized delta
func (*Patcher) UpdateDelta ¶
Apply a chunk of delta data