Skip to content

Add index.bin serializer and InvalidIndexBinError - #12

Merged
ianthetechie merged 1 commit into
stadiamaps:mainfrom
Rallista:feat/write-index-bin
Oct 13, 2026
Merged

ianthetechie merged 1 commit into
stadiamaps:mainfrom
Rallista:feat/write-index-bin

Conversation

@Archdoog

Copy link
Copy Markdown
Contributor

Add the write side of the index.bin format. It is the twin of the parser in tile_provider::tarball.

  • TileIndexBinEntry::new and the read path in TarballTileProvider::new use the same checks: the feature index and reserved bits must be zero, and the offset must be a non-zero multiple of 512.
  • serialize_index_bin changes a non-empty slice of entries into bytes without a copy. A proptest round trip and a byte-for-byte test against the fixture from official Valhalla tooling make sure that the output always parses back into the same entries.
  • A new InvalidIndexBinError gives the cause of each index failure. GraphTileProviderError wraps it in the new InvalidIndexBin variant. Index failures are no longer InvalidTarball strings.
  • parse_index_bin no longer has an assert that can panic.
  • tile_provider re-exports parse_index_bin, serialize_index_bin, TileIndexBinEntry, and InvalidIndexBinError as public items.

Add the write side of the index.bin format. It is the twin of the
parser in tile_provider::tarball.

- TileIndexBinEntry::new and the read path in TarballTileProvider::new
  use the same checks: the feature index and reserved bits must be
  zero, and the offset must be a non-zero multiple of 512.
- serialize_index_bin changes a non-empty slice of entries into bytes
  without a copy. A proptest round trip and a byte-for-byte test
  against the fixture from official Valhalla tooling make sure that
  the output always parses back into the same entries.
- A new InvalidIndexBinError gives the cause of each index failure.
  GraphTileProviderError wraps it in the new InvalidIndexBin variant.
  Index failures are no longer InvalidTarball strings.
- parse_index_bin no longer has an assert that can panic.
- tile_provider re-exports parse_index_bin, serialize_index_bin,
  TileIndexBinEntry, and InvalidIndexBinError as public items.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@ianthetechie ianthetechie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 👍

@ianthetechie

Copy link
Copy Markdown
Contributor

I think we just hit the github runner timeout due to the new tests 😂 I'll revisit that later, but I think it's fine to merge.

@ianthetechie
ianthetechie merged commit f4c59b2 into stadiamaps:main Oct 13, 2026
2 of 3 checks passed
@Archdoog Archdoog mentioned this pull request Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants