From 7ce7558d42331a73d3ac58a7bc5747302345e49c Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sat, 16 Nov 2024 02:26:42 +0100 Subject: [PATCH 1/8] change all catalog-types to use dashmap --- Cargo.lock | 16 +++++++++ Cargo.toml | 1 + martin/Cargo.toml | 1 + martin/src/bin/martin-cp.rs | 2 +- martin/src/fonts/mod.rs | 15 ++++---- martin/src/source.rs | 18 +++++----- martin/src/sprites/mod.rs | 65 ++++++++++++++++++++-------------- martin/src/srv/server.rs | 4 +-- martin/src/srv/tiles.rs | 4 +-- martin/src/srv/tiles_info.rs | 8 ++--- martin/tests/utils/pg_utils.rs | 2 +- 11 files changed, 84 insertions(+), 52 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 222c2624e..c1f573960 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1166,6 +1166,21 @@ dependencies = [ "syn 2.0.89", ] +[[package]] +name = "dashmap" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" +dependencies = [ + "cfg-if", + "crossbeam-utils", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", + "serde", +] + [[package]] name = "data-url" version = "0.3.1" @@ -2667,6 +2682,7 @@ dependencies = [ "clap", "criterion", "ctor", + "dashmap", "deadpool-postgres", "enum-display", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index 96451cdc3..ebb8c8453 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,6 +39,7 @@ cargo-husky = { version = "1", features = ["user-hooks"], default-features = fal clap = { version = "4", features = ["derive"] } criterion = { version = "0.5", features = ["async_futures", "async_tokio", "html_reports"] } ctor = "0.2" +dashmap = { version = "6.1.0", features = ["serde", "inline", "rayon"] } deadpool-postgres = "0.14" enum-display = "0.1" env_logger = "0.11" diff --git a/martin/Cargo.toml b/martin/Cargo.toml index 28dc1c4d8..1a9e522f2 100644 --- a/martin/Cargo.toml +++ b/martin/Cargo.toml @@ -79,6 +79,7 @@ async-trait.workspace = true bit-set = { workspace = true, optional = true } brotli.workspace = true clap.workspace = true +dashmap.workspace = true deadpool-postgres = { workspace = true, optional = true } enum-display.workspace = true env_logger.workspace = true diff --git a/martin/src/bin/martin-cp.rs b/martin/src/bin/martin-cp.rs index 897bc72ad..2edddf4f4 100644 --- a/martin/src/bin/martin-cp.rs +++ b/martin/src/bin/martin-cp.rs @@ -392,7 +392,7 @@ fn parse_encoding(encoding: &str) -> MartinCpResult { async fn init_schema( mbt: &Mbtiles, conn: &mut SqliteConnection, - sources: &[&dyn Source], + sources: &[TileInfoSource], tile_info: TileInfo, args: &CopyArgs, ) -> Result { diff --git a/martin/src/fonts/mod.rs b/martin/src/fonts/mod.rs index 7ab657844..70390f346 100644 --- a/martin/src/fonts/mod.rs +++ b/martin/src/fonts/mod.rs @@ -1,11 +1,10 @@ -use std::collections::hash_map::Entry; -use std::collections::{BTreeMap, HashMap}; use std::ffi::OsStr; use std::fmt::Debug; use std::path::PathBuf; use std::sync::OnceLock; use bit_set::BitSet; +use dashmap::{DashMap, Entry}; use itertools::Itertools as _; use log::{debug, info, warn}; use pbf_font_tools::freetype::{Face, Library}; @@ -103,11 +102,11 @@ fn get_available_codepoints(face: &mut Face) -> Option { #[derive(Debug, Clone, Default)] pub struct FontSources { - fonts: HashMap, + fonts: DashMap, masks: Vec, } -pub type FontCatalog = BTreeMap; +pub type FontCatalog = DashMap; #[serde_with::skip_serializing_none] #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)] @@ -125,7 +124,7 @@ impl FontSources { return Ok(Self::default()); } - let mut fonts = HashMap::new(); + let mut fonts = DashMap::new(); let lib = Library::init()?; for path in config.iter() { @@ -150,7 +149,7 @@ impl FontSources { pub fn get_catalog(&self) -> FontCatalog { self.fonts .iter() - .map(|(k, v)| (k.clone(), v.catalog_entry.clone())) + .map(|v| (v.key().clone(), v.catalog_entry.clone())) .sorted_by(|(a, _), (b, _)| a.cmp(b)) .collect() } @@ -242,7 +241,7 @@ pub struct FontSource { fn recurse_dirs( lib: &Library, path: PathBuf, - fonts: &mut HashMap, + fonts: &mut DashMap, is_top_level: bool, ) -> FontResult<()> { let start_count = fonts.len(); @@ -275,7 +274,7 @@ fn recurse_dirs( fn parse_font( lib: &Library, - fonts: &mut HashMap, + fonts: &mut DashMap, path: PathBuf, ) -> FontResult<()> { static RE_SPACES: OnceLock = OnceLock::new(); diff --git a/martin/src/source.rs b/martin/src/source.rs index d95f2fd51..e0e8d2bb6 100644 --- a/martin/src/source.rs +++ b/martin/src/source.rs @@ -1,8 +1,9 @@ -use std::collections::{BTreeMap, HashMap}; +use std::collections::HashMap; use std::fmt::Debug; use actix_web::error::ErrorNotFound; use async_trait::async_trait; +use dashmap::DashMap; use log::debug; use martin_tile_utils::{TileCoord, TileInfo}; use serde::{Deserialize, Serialize}; @@ -18,8 +19,8 @@ pub type TileInfoSource = Box; pub type TileInfoSources = Vec; #[derive(Default, Clone)] -pub struct TileSources(HashMap); -pub type TileCatalog = BTreeMap; +pub struct TileSources(DashMap); +pub type TileCatalog = DashMap; impl TileSources { #[must_use] @@ -37,16 +38,17 @@ impl TileSources { pub fn get_catalog(&self) -> TileCatalog { self.0 .iter() - .map(|(id, src)| (id.to_string(), src.get_catalog_entry())) + .map(|v| (v.key().to_string(), v.get_catalog_entry())) .collect() } - pub fn get_source(&self, id: &str) -> actix_web::Result<&dyn Source> { + pub fn get_source(&self, id: &str) -> actix_web::Result { Ok(self .0 .get(id) .ok_or_else(|| ErrorNotFound(format!("Source {id} does not exist")))? - .as_ref()) + .value() + .clone()) } /// Get a list of sources, and the tile info for the merged sources. @@ -56,7 +58,7 @@ impl TileSources { &self, source_ids: &str, zoom: Option, - ) -> actix_web::Result<(Vec<&dyn Source>, bool, TileInfo)> { + ) -> actix_web::Result<(Vec, bool, TileInfo)> { let mut sources = Vec::new(); let mut info: Option = None; let mut use_url_query = false; @@ -78,7 +80,7 @@ impl TileSources { // TODO: Use chained-if-let once available if match zoom { - Some(zoom) if Self::check_zoom(src, id, zoom) => true, + Some(zoom) if Self::check_zoom(&*src, id, zoom) => true, None => true, _ => false, } { diff --git a/martin/src/sprites/mod.rs b/martin/src/sprites/mod.rs index 7817518b6..6a6067ac7 100644 --- a/martin/src/sprites/mod.rs +++ b/martin/src/sprites/mod.rs @@ -1,8 +1,4 @@ -use std::collections::hash_map::Entry; -use std::collections::{BTreeMap, HashMap}; -use std::fmt::Debug; -use std::path::PathBuf; - +use dashmap::{DashMap, Entry}; use futures::future::try_join_all; use log::{info, warn}; use serde::{Deserialize, Serialize}; @@ -10,6 +6,9 @@ use spreet::resvg::usvg::{Error as ResvgError, Options, Tree, TreeParsing}; use spreet::{ get_svg_input_paths, sprite_name, SpreetError, Sprite, Spritesheet, SpritesheetBuilder, }; +use std::collections::BTreeMap; +use std::fmt::Debug; +use std::path::PathBuf; use tokio::io::AsyncReadExt; use self::SpriteError::{SpriteInstError, SpriteParsingError, SpriteProcessingError}; @@ -56,7 +55,7 @@ pub struct CatalogSpriteEntry { pub images: Vec, } -pub type SpriteCatalog = BTreeMap; +pub type SpriteCatalog = DashMap; #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] pub struct SpriteConfig { @@ -71,7 +70,7 @@ impl ConfigExtras for SpriteConfig { } #[derive(Debug, Clone, Default)] -pub struct SpriteSources(HashMap); +pub struct SpriteSources(DashMap); impl SpriteSources { pub fn resolve(config: &mut FileConfigEnum) -> FileResult { @@ -109,8 +108,8 @@ impl SpriteSources { pub fn get_catalog(&self) -> SpriteResult { // TODO: all sprite generation should be pre-cached - let mut entries = SpriteCatalog::new(); - for (id, source) in &self.0 { + let entries = SpriteCatalog::new(); + for source in &self.0 { let paths = get_svg_input_paths(&source.path, true) .map_err(|e| SpriteProcessingError(e, source.path.clone()))?; let mut images = Vec::with_capacity(paths.len()); @@ -121,7 +120,7 @@ impl SpriteSources { ); } images.sort(); - entries.insert(id.clone(), CatalogSpriteEntry { images }); + entries.insert(source.key().clone(), CatalogSpriteEntry { images }); } Ok(entries) } @@ -141,7 +140,7 @@ impl SpriteSources { v.insert(SpriteSource { path }); } } - }; + } } /// Given a list of IDs in a format "id1,id2,id3", return a spritesheet with them all. @@ -155,14 +154,17 @@ impl SpriteSources { let sprite_ids = ids .split(',') - .map(|id| { - self.0 - .get(id) - .ok_or_else(|| SpriteError::SpriteNotFound(id.to_string())) - }) + .map(|id| self.get(id)) .collect::>>()?; - get_spritesheet(sprite_ids.into_iter(), dpi, as_sdf).await + get_spritesheet(sprite_ids.iter(), dpi, as_sdf).await + } + + fn get(&self, id: &str) -> SpriteResult { + match self.0.get(id) { + Some(v) => Ok(v.clone()), + None => Err(SpriteError::SpriteNotFound(id.to_string())), + } } } @@ -247,19 +249,30 @@ mod tests { //.sdf => generate sdf from png, add sdf == true //- => does not generate sdf, omits sdf == true for extension in ["_sdf", ""] { - test_src(sprites.values(), 1, "all_1", extension).await; - test_src(sprites.values(), 2, "all_2", extension).await; - - test_src(sprites.get("src1").into_iter(), 1, "src1_1", extension).await; - test_src(sprites.get("src1").into_iter(), 2, "src1_2", extension).await; - - test_src(sprites.get("src2").into_iter(), 1, "src2_1", extension).await; - test_src(sprites.get("src2").into_iter(), 2, "src2_2", extension).await; + let paths = sprites.iter().map(|v| v.path.clone()).collect::>(); + test_src(paths.iter(), 1, "all_1", extension).await; + test_src(paths.iter(), 2, "all_2", extension).await; + + let src1_path = sprites + .get("src1") + .into_iter() + .map(|v| v.path.clone()) + .collect::>(); + test_src(src1_path.iter(), 1, "src1_1", extension).await; + test_src(src1_path.iter(), 2, "src1_2", extension).await; + + let src2_path = sprites + .get("src2") + .into_iter() + .map(|v| v.path.clone()) + .collect::>(); + test_src(src2_path.iter(), 1, "src2_1", extension).await; + test_src(src2_path.iter(), 2, "src2_2", extension).await; } } async fn test_src( - sources: impl Iterator, + sources: impl Iterator, pixel_ratio: u8, filename: &str, extension: &str, diff --git a/martin/src/srv/server.rs b/martin/src/srv/server.rs index a33d39a4f..7482e3ba3 100755 --- a/martin/src/srv/server.rs +++ b/martin/src/srv/server.rs @@ -40,7 +40,7 @@ pub const RESERVED_KEYWORDS: &[&str] = &[ "reload", "sprite", "status", ]; -#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Debug, Clone, Default, Serialize, Deserialize)] pub struct Catalog { pub tiles: TileCatalog, #[cfg(feature = "sprites")] @@ -226,7 +226,7 @@ pub mod tests { } fn clone_source(&self) -> TileInfoSource { - unimplemented!() + Box::new(self.clone()) } async fn get_tile( diff --git a/martin/src/srv/tiles.rs b/martin/src/srv/tiles.rs index 7d9689a01..5a73fd7ff 100755 --- a/martin/src/srv/tiles.rs +++ b/martin/src/srv/tiles.rs @@ -14,7 +14,7 @@ use martin_tile_utils::{ use serde::Deserialize; use crate::args::PreferredEncoding; -use crate::source::{Source, TileSources, UrlQuery}; +use crate::source::{Source, TileInfoSource, TileInfoSources, TileSources, UrlQuery}; use crate::srv::server::map_internal_error; use crate::srv::SrvConfig; use crate::utils::cache::get_or_insert_cached_value; @@ -62,7 +62,7 @@ async fn get_tile( } pub struct DynTileSource<'a> { - pub sources: Vec<&'a dyn Source>, + pub sources: TileInfoSources, pub info: TileInfo, pub query_str: Option<&'a str>, pub query_obj: Option, diff --git a/martin/src/srv/tiles_info.rs b/martin/src/srv/tiles_info.rs index a93313808..1e6b6305b 100755 --- a/martin/src/srv/tiles_info.rs +++ b/martin/src/srv/tiles_info.rs @@ -8,7 +8,7 @@ use itertools::Itertools as _; use serde::Deserialize; use tilejson::{tilejson, TileJSON}; -use crate::source::{Source, TileSources}; +use crate::source::{Source, TileInfoSource, TileSources}; use crate::srv::SrvConfig; #[derive(Deserialize)] @@ -62,7 +62,7 @@ async fn get_source_info( } #[must_use] -pub fn merge_tilejson(sources: &[&dyn Source], tiles_url: String) -> TileJSON { +pub fn merge_tilejson(sources: &[TileInfoSource], tiles_url: String) -> TileJSON { if sources.len() == 1 { let mut tj = sources[0].get_tilejson().clone(); tj.tiles = vec![tiles_url]; @@ -183,7 +183,7 @@ pub mod tests { }, data: Vec::default(), }; - let tj = merge_tilejson(&[&src1], url.clone()); + let tj = merge_tilejson(&[Box::new(src1.clone())], url.clone()); assert_eq!( TileJSON { tiles: vec![url.clone()], @@ -210,7 +210,7 @@ pub mod tests { data: Vec::default(), }; - let tj = merge_tilejson(&[&src1, &src2], url.clone()); + let tj = merge_tilejson(&[Box::new(src1.clone()), Box::new(src2)], url.clone()); assert_eq!(tj.tiles, vec![url]); assert_eq!(tj.name, Some("layer1,layer2".to_string())); assert_eq!(tj.minzoom, Some(5)); diff --git a/martin/tests/utils/pg_utils.rs b/martin/tests/utils/pg_utils.rs index 02116664b..151bca711 100644 --- a/martin/tests/utils/pg_utils.rs +++ b/martin/tests/utils/pg_utils.rs @@ -44,7 +44,7 @@ pub fn table<'a>(mock: &'a MockSource, name: &str) -> &'a martin::pg::TableInfo #[allow(dead_code)] #[must_use] -pub fn source<'a>(mock: &'a MockSource, name: &str) -> &'a dyn Source { +pub fn source(mock: &MockSource, name: &str) -> Box { let (sources, _) = mock; sources.tiles.get_source(name).unwrap() } From 935f30c0e6523b8839fa01abcecdd7b52e44a2e7 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sat, 16 Nov 2024 21:23:30 +0100 Subject: [PATCH 2/8] enabled the rayon feature --- Cargo.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.lock b/Cargo.lock index c1f573960..f397ab751 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1178,6 +1178,7 @@ dependencies = [ "lock_api", "once_cell", "parking_lot_core", + "rayon", "serde", ] From fc02e14f261d94f637c8747cab9d6f1850d53345 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Thu, 26 Dec 2024 00:56:34 +0100 Subject: [PATCH 3/8] fixed imports --- martin/src/bin/martin-cp.rs | 2 +- martin/src/lib.rs | 2 +- martin/src/srv/tiles.rs | 2 +- martin/src/srv/tiles_info.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/martin/src/bin/martin-cp.rs b/martin/src/bin/martin-cp.rs index 2edddf4f4..4ccedf666 100644 --- a/martin/src/bin/martin-cp.rs +++ b/martin/src/bin/martin-cp.rs @@ -14,7 +14,7 @@ use log::{debug, error, info, log_enabled}; use martin::args::{Args, ExtraArgs, MetaArgs, OsEnv, SrvArgs}; use martin::srv::{merge_tilejson, DynTileSource}; use martin::{ - append_rect, read_config, Config, MartinError, MartinResult, ServerState, Source, TileData, + append_rect, read_config, Config, MartinError, MartinResult, ServerState, TileInfoSource, TileData, TileRect, }; use martin_tile_utils::{bbox_to_xyz, TileCoord, TileInfo}; diff --git a/martin/src/lib.rs b/martin/src/lib.rs index 59548426a..a81f6c5f3 100644 --- a/martin/src/lib.rs +++ b/martin/src/lib.rs @@ -5,7 +5,7 @@ mod config; pub use config::{read_config, Config, ServerState}; mod source; -pub use source::{CatalogSourceEntry, Source, Tile, TileData, TileSources, UrlQuery}; +pub use source::{CatalogSourceEntry, TileInfoSource, Source, Tile, TileData, TileSources, UrlQuery}; mod utils; pub use utils::{ diff --git a/martin/src/srv/tiles.rs b/martin/src/srv/tiles.rs index 5a73fd7ff..0d2aa99f5 100755 --- a/martin/src/srv/tiles.rs +++ b/martin/src/srv/tiles.rs @@ -14,7 +14,7 @@ use martin_tile_utils::{ use serde::Deserialize; use crate::args::PreferredEncoding; -use crate::source::{Source, TileInfoSource, TileInfoSources, TileSources, UrlQuery}; +use crate::source::{TileInfoSources, TileSources, UrlQuery}; use crate::srv::server::map_internal_error; use crate::srv::SrvConfig; use crate::utils::cache::get_or_insert_cached_value; diff --git a/martin/src/srv/tiles_info.rs b/martin/src/srv/tiles_info.rs index 1e6b6305b..ced157308 100755 --- a/martin/src/srv/tiles_info.rs +++ b/martin/src/srv/tiles_info.rs @@ -8,7 +8,7 @@ use itertools::Itertools as _; use serde::Deserialize; use tilejson::{tilejson, TileJSON}; -use crate::source::{Source, TileInfoSource, TileSources}; +use crate::source::{TileInfoSource, TileSources}; use crate::srv::SrvConfig; #[derive(Deserialize)] From 1a683b26a3cdaff81e4b2856430fd04d966a650b Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Fri, 21 Feb 2025 03:22:58 +0100 Subject: [PATCH 4/8] formatting fixes --- martin/src/bin/martin-cp.rs | 4 ++-- martin/src/lib.rs | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/martin/src/bin/martin-cp.rs b/martin/src/bin/martin-cp.rs index 4ccedf666..5fa92eba4 100644 --- a/martin/src/bin/martin-cp.rs +++ b/martin/src/bin/martin-cp.rs @@ -14,8 +14,8 @@ use log::{debug, error, info, log_enabled}; use martin::args::{Args, ExtraArgs, MetaArgs, OsEnv, SrvArgs}; use martin::srv::{merge_tilejson, DynTileSource}; use martin::{ - append_rect, read_config, Config, MartinError, MartinResult, ServerState, TileInfoSource, TileData, - TileRect, + append_rect, read_config, Config, MartinError, MartinResult, ServerState, TileData, + TileInfoSource, TileRect, }; use martin_tile_utils::{bbox_to_xyz, TileCoord, TileInfo}; use mbtiles::sqlx::SqliteConnection; diff --git a/martin/src/lib.rs b/martin/src/lib.rs index 3682043f4..6683165b4 100644 --- a/martin/src/lib.rs +++ b/martin/src/lib.rs @@ -5,7 +5,9 @@ mod config; pub use config::{read_config, Config, ServerState}; mod source; -pub use source::{CatalogSourceEntry, TileInfoSource, Source, Tile, TileData, TileSources, UrlQuery}; +pub use source::{ + CatalogSourceEntry, Source, Tile, TileData, TileInfoSource, TileSources, UrlQuery, +}; mod utils; pub use utils::{ From ba77ca73ad18f3a08efc1557598d3795ba73ac01 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sat, 1 Mar 2025 15:17:18 +0100 Subject: [PATCH 5/8] fix testcase failiour caused by bodged merge --- martin/src/sprites/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/martin/src/sprites/mod.rs b/martin/src/sprites/mod.rs index 6a6067ac7..4d77d9551 100644 --- a/martin/src/sprites/mod.rs +++ b/martin/src/sprites/mod.rs @@ -249,14 +249,14 @@ mod tests { //.sdf => generate sdf from png, add sdf == true //- => does not generate sdf, omits sdf == true for extension in ["_sdf", ""] { - let paths = sprites.iter().map(|v| v.path.clone()).collect::>(); + let paths = sprites.iter().map(|v| v.value().clone()).collect::>(); test_src(paths.iter(), 1, "all_1", extension).await; test_src(paths.iter(), 2, "all_2", extension).await; let src1_path = sprites .get("src1") .into_iter() - .map(|v| v.path.clone()) + .map(|v| v.value().clone()) .collect::>(); test_src(src1_path.iter(), 1, "src1_1", extension).await; test_src(src1_path.iter(), 2, "src1_2", extension).await; @@ -264,7 +264,7 @@ mod tests { let src2_path = sprites .get("src2") .into_iter() - .map(|v| v.path.clone()) + .map(|v| v.value().clone()) .collect::>(); test_src(src2_path.iter(), 1, "src2_1", extension).await; test_src(src2_path.iter(), 2, "src2_2", extension).await; @@ -272,7 +272,7 @@ mod tests { } async fn test_src( - sources: impl Iterator, + sources: impl Iterator, pixel_ratio: u8, filename: &str, extension: &str, From a6c7435e375abe6c2e4b6c4ee33f1fe740fcaa3f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 1 Mar 2025 14:18:47 +0000 Subject: [PATCH 6/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- martin/src/sprites/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/martin/src/sprites/mod.rs b/martin/src/sprites/mod.rs index 4d77d9551..31a62c3f7 100644 --- a/martin/src/sprites/mod.rs +++ b/martin/src/sprites/mod.rs @@ -249,7 +249,10 @@ mod tests { //.sdf => generate sdf from png, add sdf == true //- => does not generate sdf, omits sdf == true for extension in ["_sdf", ""] { - let paths = sprites.iter().map(|v| v.value().clone()).collect::>(); + let paths = sprites + .iter() + .map(|v| v.value().clone()) + .collect::>(); test_src(paths.iter(), 1, "all_1", extension).await; test_src(paths.iter(), 2, "all_2", extension).await; From 531b96eb758d701b549a4a48724fb9dc3073b965 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sat, 1 Mar 2025 15:47:20 +0100 Subject: [PATCH 7/8] fix another merge-fail --- martin/tests/pg_function_source_test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/martin/tests/pg_function_source_test.rs b/martin/tests/pg_function_source_test.rs index cf7d81718..bde703117 100644 --- a/martin/tests/pg_function_source_test.rs +++ b/martin/tests/pg_function_source_test.rs @@ -16,8 +16,8 @@ fn init() { #[actix_rt::test] async fn function_source_tilejson() { let mock = mock_sources(mock_pgcfg("connection_string: $DATABASE_URL")).await; - let tj = source(&mock, "function_zxy_query").get_tilejson(); - assert_yaml_snapshot!(tj, @r" + let src = source(&mock, "function_zxy_query"); + assert_yaml_snapshot!(src.get_tilejson(), @r" tilejson: 3.0.0 tiles: [] name: function_zxy_query From 26ba9a341a959144b76d7a56c306003862a0f28f Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sat, 1 Mar 2025 16:14:05 +0100 Subject: [PATCH 8/8] fix another bodged merge --- martin/tests/pg_server_test.rs | 4 ++-- martin/tests/pg_table_source_test.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/martin/tests/pg_server_test.rs b/martin/tests/pg_server_test.rs index d826f8ff2..f71d547af 100644 --- a/martin/tests/pg_server_test.rs +++ b/martin/tests/pg_server_test.rs @@ -1024,8 +1024,8 @@ tables: let src = table(&mock, "no_id"); assert_eq!(src.id_column, None); assert!(matches!(&src.properties, Some(v) if v.len() == 1)); - let tj = source(&mock, "no_id").get_tilejson(); - assert_yaml_snapshot!(tj, @r" + let src = source(&mock, "no_id"); + assert_yaml_snapshot!(src.get_tilejson(), @r" tilejson: 3.0.0 tiles: [] vector_layers: diff --git a/martin/tests/pg_table_source_test.rs b/martin/tests/pg_table_source_test.rs index 5db4b01c2..36dc4e949 100644 --- a/martin/tests/pg_table_source_test.rs +++ b/martin/tests/pg_table_source_test.rs @@ -129,8 +129,8 @@ async fn table_source() { #[actix_rt::test] async fn tables_tilejson() { let mock = mock_sources(mock_pgcfg("connection_string: $DATABASE_URL")).await; - let tj = source(&mock, "table_source").get_tilejson(); - assert_yaml_snapshot!(tj, @r" + let src = source(&mock, "table_source"); + assert_yaml_snapshot!(src.get_tilejson(), @r" tilejson: 3.0.0 tiles: [] vector_layers: