Skip to content

Commit

Permalink
Cleanup mbtiles, rename TileCopierOptions, testing (#916)
Browse files Browse the repository at this point in the history
* Rename `TileCopierOptions` -> `TileCopier`
* remove a few un-needed sqlite open to detect mbtiles type
* move `open_and_detect_type` to `MBTiles`
* add `attach_to` to `MBTiles`
* move various table creation fn to mbtiles_queries file
* a few sql format
  • Loading branch information
nyurik authored Oct 2, 2023
1 parent 14ea5cb commit 6b7bcab
Show file tree
Hide file tree
Showing 20 changed files with 434 additions and 472 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ indoc = "2"
itertools = "0.11"
json-patch = "1.1"
log = "0.4"
martin-mbtiles = { path = "./martin-mbtiles", version = "0.5.0", default-features = false }
martin-mbtiles = { path = "./martin-mbtiles", version = "0.6.0", default-features = false }
martin-tile-utils = { path = "./martin-tile-utils", version = "0.1.0" }
num_cpus = "1"
pmtiles = { version = "0.3", features = ["mmap-async-tokio", "tilejson"] }
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion martin-mbtiles/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "martin-mbtiles"
version = "0.5.0"
version = "0.6.0"
authors = ["Yuri Astrakhan <[email protected]>", "MapLibre contributors"]
description = "A simple low-level MbTiles access and processing library, with some tile format detection and other relevant heuristics."
keywords = ["mbtiles", "maps", "tiles", "mvt", "tilejson"]
Expand Down
22 changes: 10 additions & 12 deletions martin-mbtiles/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ use std::path::{Path, PathBuf};

use clap::{Parser, Subcommand};
use log::{error, LevelFilter};
use martin_mbtiles::{
apply_mbtiles_diff, IntegrityCheckType, MbtResult, Mbtiles, TileCopierOptions,
};
use martin_mbtiles::{apply_mbtiles_diff, IntegrityCheckType, MbtResult, Mbtiles, TileCopier};

#[derive(Parser, PartialEq, Eq, Debug)]
#[command(
Expand Down Expand Up @@ -48,7 +46,7 @@ enum Commands {
},
/// Copy tiles from one mbtiles file to another.
#[command(name = "copy")]
Copy(TileCopierOptions),
Copy(TileCopier),
/// Apply diff file generated from 'copy' command
#[command(name = "apply-diff")]
ApplyDiff {
Expand Down Expand Up @@ -165,7 +163,7 @@ mod tests {

use clap::error::ErrorKind;
use clap::Parser;
use martin_mbtiles::{CopyDuplicateMode, TileCopierOptions};
use martin_mbtiles::{CopyDuplicateMode, TileCopier};

use crate::Commands::{ApplyDiff, Copy, MetaGetValue, MetaSetValue, Validate};
use crate::{Args, IntegrityCheckType};
Expand All @@ -186,7 +184,7 @@ mod tests {
Args::parse_from(["mbtiles", "copy", "src_file", "dst_file"]),
Args {
verbose: false,
command: Copy(TileCopierOptions::new(
command: Copy(TileCopier::new(
PathBuf::from("src_file"),
PathBuf::from("dst_file")
))
Expand All @@ -210,7 +208,7 @@ mod tests {
Args {
verbose: false,
command: Copy(
TileCopierOptions::new(PathBuf::from("src_file"), PathBuf::from("dst_file"))
TileCopier::new(PathBuf::from("src_file"), PathBuf::from("dst_file"))
.min_zoom(Some(1))
.max_zoom(Some(100))
)
Expand Down Expand Up @@ -270,7 +268,7 @@ mod tests {
Args {
verbose: false,
command: Copy(
TileCopierOptions::new(PathBuf::from("src_file"), PathBuf::from("dst_file"))
TileCopier::new(PathBuf::from("src_file"), PathBuf::from("dst_file"))
.zoom_levels(vec![1, 3, 7])
)
}
Expand All @@ -291,7 +289,7 @@ mod tests {
Args {
verbose: false,
command: Copy(
TileCopierOptions::new(PathBuf::from("src_file"), PathBuf::from("dst_file"))
TileCopier::new(PathBuf::from("src_file"), PathBuf::from("dst_file"))
.diff_with_file(PathBuf::from("no_file"))
)
}
Expand All @@ -312,7 +310,7 @@ mod tests {
Args {
verbose: false,
command: Copy(
TileCopierOptions::new(PathBuf::from("src_file"), PathBuf::from("dst_file"))
TileCopier::new(PathBuf::from("src_file"), PathBuf::from("dst_file"))
.on_duplicate(CopyDuplicateMode::Override)
)
}
Expand All @@ -333,7 +331,7 @@ mod tests {
Args {
verbose: false,
command: Copy(
TileCopierOptions::new(PathBuf::from("src_file"), PathBuf::from("dst_file"))
TileCopier::new(PathBuf::from("src_file"), PathBuf::from("dst_file"))
.on_duplicate(CopyDuplicateMode::Ignore)
)
}
Expand All @@ -354,7 +352,7 @@ mod tests {
Args {
verbose: false,
command: Copy(
TileCopierOptions::new(PathBuf::from("src_file"), PathBuf::from("dst_file"))
TileCopier::new(PathBuf::from("src_file"), PathBuf::from("dst_file"))
.on_duplicate(CopyDuplicateMode::Abort)
)
}
Expand Down
2 changes: 1 addition & 1 deletion martin-mbtiles/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ mod mbtiles_pool;
pub use mbtiles_pool::MbtilesPool;

mod tile_copier;
pub use tile_copier::{apply_mbtiles_diff, CopyDuplicateMode, TileCopierOptions};
pub use tile_copier::{apply_mbtiles_diff, CopyDuplicateMode, TileCopier};

mod mbtiles_queries;
Loading

0 comments on commit 6b7bcab

Please sign in to comment.