NeededByteRanges returns the byte ranges of the target file that still need to be obtained. Public for advanced use only: this is mainly used internally, but can be used by the caller if desired.
()
| 159 | // Public for advanced use only: this is mainly used internally, but can be |
| 160 | // used by the caller if desired. |
| 161 | func (zs *Syncer) NeededByteRanges() []ByteRange { |
| 162 | blockRanges := zs.rs.NeededBlockRanges(0, rcksum.BlockID(zs.blocks-1)) |
| 163 | byteRanges := make([]ByteRange, len(blockRanges)) |
| 164 | for i, br := range blockRanges { |
| 165 | byteRanges[i].Start = int64(br.Start) * zs.blocksize |
| 166 | end := int64(br.End+1)*zs.blocksize - 1 |
| 167 | if end >= zs.filelen { |
| 168 | end = zs.filelen - 1 |
| 169 | } |
| 170 | byteRanges[i].End = end |
| 171 | } |
| 172 | return byteRanges |
| 173 | } |
| 174 | |
| 175 | // SubmitTargetData takes received blocks of target data and uses them to fill |
| 176 | // in missing chunks of the target file. |
no test coverage detected