-
-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* `mbtiles diff` now has an additional `--patch-type` param with `whole`, `bin-diff-raw` and `bin-diff-gz` values: * `whole` stores different tiles as before - as whole tiles in the `tiles` table * `bin-diff-raw` computes binary difference between tiles, and stores them as brotli-encoded value in a `bsdiffraw` table, together with a `xxh3_64` hash of the tile as it will be stored after patching * `bin-diff-gz` same as `bin-diff-raw`, but assumes the tiles are gzip-compressed, so it uncompresses them before comparing. The `xxh3_64` stores the hash of the uncompressed tile. The data will be stored in the `bsdiffrawgz` table (identical structure with above) * `mbtiles copy --apply-patch` will automatically detect if `bsdiffrawgz` or `bsdiffraw` tables exist, and will use binary patching. * `mbtiles apply-patch` does not support binary patching yet * `mbtiles copy --diff-with-file ... --patch-type ...` is an alias to `mbtiles diff --patch-type ...`
- Loading branch information
Showing
48 changed files
with
1,263 additions
and
319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,6 @@ test_log* | |
pg_data/ | ||
config.yml | ||
tests/output/ | ||
tests/mbtiles_temp_files/ | ||
tmp/ | ||
.aws-sam/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ lints.workspace = true | |
|
||
[package] | ||
name = "martin-tile-utils" | ||
version = "0.4.1" | ||
version = "0.5.0" | ||
authors = ["Yuri Astrakhan <[email protected]>", "MapLibre contributors"] | ||
description = "Utilities to help with map tile processing, such as type and compression detection. Used by the MapLibre's Martin tile server." | ||
keywords = ["maps", "tiles", "mvt", "tileserver"] | ||
|
@@ -17,6 +17,8 @@ repository.workspace = true | |
rust-version.workspace = true | ||
|
||
[dependencies] | ||
brotli.workspace = true | ||
flate2.workspace = true | ||
|
||
[dev-dependencies] | ||
approx.workspace = true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use std::io::{Read as _, Write as _}; | ||
|
||
use flate2::read::GzDecoder; | ||
use flate2::write::GzEncoder; | ||
|
||
pub fn decode_gzip(data: &[u8]) -> Result<Vec<u8>, std::io::Error> { | ||
let mut decoder = GzDecoder::new(data); | ||
let mut decompressed = Vec::new(); | ||
decoder.read_to_end(&mut decompressed)?; | ||
Ok(decompressed) | ||
} | ||
|
||
pub fn encode_gzip(data: &[u8]) -> Result<Vec<u8>, std::io::Error> { | ||
let mut encoder = GzEncoder::new(Vec::new(), flate2::Compression::default()); | ||
encoder.write_all(data)?; | ||
encoder.finish() | ||
} | ||
|
||
pub fn decode_brotli(data: &[u8]) -> Result<Vec<u8>, std::io::Error> { | ||
let mut decoder = brotli::Decompressor::new(data, 4096); | ||
let mut decompressed = Vec::new(); | ||
decoder.read_to_end(&mut decompressed)?; | ||
Ok(decompressed) | ||
} | ||
|
||
pub fn encode_brotli(data: &[u8]) -> Result<Vec<u8>, std::io::Error> { | ||
let mut encoder = brotli::CompressorWriter::new(Vec::new(), 4096, 11, 22); | ||
encoder.write_all(data)?; | ||
Ok(encoder.into_inner()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ lints.workspace = true | |
[package] | ||
name = "martin" | ||
# Once the release is published with the hash, update https://github.com/maplibre/homebrew-martin | ||
version = "0.13.0" | ||
version = "0.14.0" | ||
authors = ["Stepan Kuzmin <[email protected]>", "Yuri Astrakhan <[email protected]>", "MapLibre contributors"] | ||
description = "Blazing fast and lightweight tile server with PostGIS, MBTiles, and PMTiles support" | ||
keywords = ["maps", "tiles", "mbtiles", "pmtiles", "postgis"] | ||
|
@@ -81,7 +81,6 @@ clap.workspace = true | |
deadpool-postgres = { workspace = true, optional = true } | ||
enum-display.workspace = true | ||
env_logger.workspace = true | ||
flate2.workspace = true | ||
futures.workspace = true | ||
itertools.workspace = true | ||
json-patch = { workspace = true, optional = true } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.