feat: mbtiles hash extraction support#1787
Conversation
for more information, see https://pre-commit.ci
|
we really ought to just generate our own test files - perhaps have a short SQLite script that fake-creates a few mbtiles with well understood properties. This way instead of checking in binary blobs, we can check in and generate these files on the fiy, and have an easy to inspect SQL that shows what they have. |
| maxzoom: 6 | ||
| minzoom: 0 |
There was a problem hiding this comment.
Agree that generating test files might uncover bugs.
Here we are handling this too simplistic for example.
We are trusting that the metadata is actually valid.
There was a problem hiding this comment.
yep, and actually generating sqlite files should be very simple - we can just use the .dump command in sqlite to export the content of all existing files, delete the originals, clean up the generated dumps, remove any unrelated stuff from them, and use them to generate .mbtiles files during testing - e.g. with some extra init-mbtiles just command to set them up in some build dir.
nyurik
left a comment
There was a problem hiding this comment.
this looks good, but I don't want to merge something that is not being used, i.e. dead code -- can you add usage of the new fn to martin itself?
|
This is not actually dead code... mbtiles is a libary The actual PR implementing ETAGs is a bit messy and needed another refactoring round before being an PR. We can leave it open and merge once I get to finishing that work. |
nyurik
left a comment
There was a problem hiding this comment.
fair enough, lets merge, and thanks!
This PR adds basic etag handling to the tile serving. I am currently using an okay hash function for this. There [are better ones like `gxhash`](https://github.com/ogxd/gxhash?tab=readme-ov-file#benchmarks), but for compatability with the `mbtiles`-crate, using `xxhash` is likely also fine. Also, `xxhash` does not require SIMD. | previous | now | |--------|--------| |  |  | |  |  | |  |  | This is the next PR in the chain started at #1787
(PR is based on #1786 => merge said PR first before looking at this one.)
This PR adds support to the
mbtilescrate to hand out which hash corresponds to a tile.The flat case might be debatable: Here I chose to md5 hash it to make upstream code more readable. The alternative would be to in this case return
Nonefor the hash.This looks more intimidating than it actully is. Most of the lines are unit-tests.