Re: rsync delta between binary files
Donovan Baarda <[email protected]> Wed, 25 May 2005 18:06:08 +0100
| Newsgroups | gmane.network.librsync.general |
|---|---|
| Message-ID | <[email protected]> |
Hendrik Mangels wrote: > hi, > > easy question: I need to know which size the delta is, rsync produces > when syncing two particular (binary) files. So to speak: what will go > over the wire, in the end. Is this what rdiff does? This is the librsync list, not the rsync list. librsync is a library implementation of the rsync algorithm, and is not used by the current rsync application. rdiff is a small utility that uses the librsync library to generate the signature of a file, caculate a delta between a signature and another file, and apply the delta to the file. It does not have any network transport, so doesn't send anything "over the wire". You can use rdiff to syncronise something "over the wire" using rdiff by using something else to transmit/receive the signature and patch files. This would be done as follows; 1) generate a signature for the old file to be updated 2) send the signature to the other end 3) use the signature to calculate a delta from the old file to the new file. 4) send the delta to the other end 5) apply the delta to the old file, updating it to match the new file. Note that the signature must be sent to the updated end, and the delta is sent to the old end. I think the question you are asking is effectively "how big is the signature and delta". The size of the signature is about 12 bytes per block. The default block size is 2048 bytes, so the signature size should be about 12/2048th the file size (Note: for very large files I suggest specifying a block size of sqrt(filesize)). The size of the delta depends on how different the files are. The delta format includes "copy" and "insert" instructions. The copy instructions are very compact. The insert instructions include all the data to insert. I'm not sure, but rdiff may also compress this delta using gzip. This means that the delta pretty much only includes changes (maybe compressed). No changes -> small delta (one copy instruction), all changes -> large delta (one big insert instruction). -- Donovan Baarda ------------------------------------------------------- SF.Net email is sponsored by: GoToMeeting - the easiest way to collaborate online with coworkers and clients while avoiding the high cost of travel and communications. There is no equipment to buy and you can meet as often as you want. Try it free.http://ads.osdn.com/?ad_id=7402&alloc_id=16135&op=click