Skip to content

Commit

Permalink
Make all Path funcs consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCutter committed Aug 29, 2024
1 parent a3e0f06 commit 0ac1525
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api/layout/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ func NWithSuffix(l, n, logSize uint64) string {
// EntriesPath returns the local path for the nth entry bundle. p denotes the partial
// tile size, or 0 if the tile is complete.
func EntriesPath(n, logSize uint64) string {
return fmt.Sprintf("tile/entries%s", NWithSuffix(0, n, logSize))
return fmt.Sprintf("tile/entries/%s", NWithSuffix(0, n, logSize))
}

// TilePath builds the path to the subtree tile with the given level and index in tile space.
func TilePath(tileLevel, tileIndex, logSize uint64) string {
return fmt.Sprintf("tile/%d%s", tileLevel, NWithSuffix(tileLevel, tileIndex, logSize))
return fmt.Sprintf("tile/%d/%s", tileLevel, NWithSuffix(tileLevel, tileIndex, logSize))
}

// fmtN returns the "N" part of a Tiles-spec path.
Expand All @@ -66,10 +66,10 @@ func TilePath(tileLevel, tileIndex, logSize uint64) string {
//
// See https://github.com/C2SP/C2SP/blob/main/tlog-tiles.md#:~:text=index%201234067%20will%20be%20encoded%20as%20x001/x234/067
func fmtN(N uint64) string {
n := fmt.Sprintf("/%03d", N%1000)
n := fmt.Sprintf("%03d", N%1000)
N /= 1000
for N > 0 {
n = fmt.Sprintf("/x%03d%s", N%1000, n)
n = fmt.Sprintf("x%03d/%s", N%1000, n)
N /= 1000
}
return n
Expand Down

0 comments on commit 0ac1525

Please sign in to comment.