go-sync
go-sync copied to clipboard
failed to understand http_test.go
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?
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.