go-sync icon indicating copy to clipboard operation
go-sync copied to clipboard

failed to understand http_test.go

Open chrislusf opened this issue 10 years ago • 1 comments

I failed to understand this http download example:

https://github.com/Redundancy/go-sync/blob/master/http_test.go#L68

It is using the to-be-downloaded reference data to calculate the referenceFileIndex and checksumLookup, on the client side, to fetch the reference data from the server side?

chrislusf avatar Sep 16 '15 19:09 chrislusf

In this case, the example is generating the index data that it will need to know what blocks to download, rather than downloading it at the start. I should probably not take that shortcut (or make it clearer).

In some ways, partially because it's leaving out the server side (that the example needs to have a fully working self-contained example) https://github.com/Redundancy/go-sync/blob/master/gosync/patch.go is easier to follow.

Redundancy avatar Sep 16 '15 19:09 Redundancy