Skip to content

Commit

Permalink
contiguous
Browse files Browse the repository at this point in the history
  • Loading branch information
bdon committed Jan 20, 2024
1 parent befb8d3 commit cdbd4ab
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pmtiles/makesync.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,14 @@ func Sync(logger *log.Logger, file string, syncfilename string, overfetch float3

ranges := make([]SrcDstRange,0)
for _, v := range wanted {
ranges = append(ranges,SrcDstRange{SrcOffset:v.Offset,DstOffset:v.Offset,Length:v.Length})
l := len(ranges)
if l > 0 && (ranges[l-1].SrcOffset + ranges[l-1].Length) == v.Offset {
ranges[l-1].Length = ranges[l-1].Length + v.Length
} else {
ranges = append(ranges,SrcDstRange{SrcOffset:v.Offset,DstOffset:v.Offset,Length:v.Length})
}
}
fmt.Printf("need %d chunks.\n", len(ranges))

requests, _ := MergeRanges(ranges, overfetch)
fmt.Printf("need %d requests with overfetch=%f.\n", requests.Len(), overfetch)
Expand Down

0 comments on commit cdbd4ab

Please sign in to comment.