Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik committed Jun 25, 2024
1 parent 3385ef8 commit d61e4b2
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 30 deletions.
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ cp *ARGS:

# Run mbtiles command
mbtiles *ARGS:
cargo run --release -p mbtiles -- {{ ARGS }}
cargo run -p mbtiles -- {{ ARGS }}

# Start release-compiled Martin server and a test database
run-release *ARGS: start
Expand Down
6 changes: 2 additions & 4 deletions martin/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ use async_trait::async_trait;
use criterion::async_executor::FuturesExecutor;
use criterion::{criterion_group, criterion_main, Criterion};
use martin::srv::DynTileSource;
use martin::{
CatalogSourceEntry, MartinResult, Source, TileCoord, TileData, TileSources, UrlQuery,
};
use martin_tile_utils::{Encoding, Format, TileInfo};
use martin::{CatalogSourceEntry, MartinResult, Source, TileData, TileSources, UrlQuery};
use martin_tile_utils::{Encoding, Format, TileCoord, TileInfo};
use pprof::criterion::{Output, PProfProfiler};
use tilejson::{tilejson, TileJSON};

Expand Down
6 changes: 3 additions & 3 deletions martin/src/bin/martin-cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ 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, TileCoord,
TileData, TileRect,
append_rect, read_config, Config, MartinError, MartinResult, ServerState, Source, TileData,
TileRect,
};
use martin_tile_utils::{bbox_to_xyz, TileInfo};
use martin_tile_utils::{bbox_to_xyz, TileCoord, TileInfo};
use mbtiles::sqlx::SqliteConnection;
use mbtiles::UpdateZoomType::GrowOnly;
use mbtiles::{
Expand Down
4 changes: 2 additions & 2 deletions martin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pub use source::{CatalogSourceEntry, Source, Tile, TileData, TileSources, UrlQue

mod utils;
pub use utils::{
append_rect, IdResolver, MartinError, MartinResult, OptBoolObj, OptOneMany, TileCoord,
TileRect, NO_MAIN_CACHE,
append_rect, IdResolver, MartinError, MartinResult, OptBoolObj, OptOneMany, TileRect,
NO_MAIN_CACHE,
};

pub mod args;
Expand Down
4 changes: 2 additions & 2 deletions martin/src/mbtiles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::sync::Arc;

use async_trait::async_trait;
use log::trace;
use martin_tile_utils::TileInfo;
use martin_tile_utils::{TileCoord, TileInfo};
use mbtiles::MbtilesPool;
use serde::{Deserialize, Serialize};
use tilejson::TileJSON;
Expand All @@ -15,7 +15,7 @@ use crate::config::UnrecognizedValues;
use crate::file_config::FileError::{AcquireConnError, InvalidMetadata, IoError};
use crate::file_config::{ConfigExtras, FileResult, SourceConfigExtras};
use crate::source::{TileData, UrlQuery};
use crate::{MartinResult, Source, TileCoord};
use crate::{MartinResult, Source};

#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct MbtConfig {
Expand Down
5 changes: 1 addition & 4 deletions martin/src/pg/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use std::path::PathBuf;

use deadpool_postgres::tokio_postgres::Error as TokioPgError;
use deadpool_postgres::{BuildError, PoolError};
use martin_tile_utils::TileCoord;
use semver::Version;

use crate::pg::utils::query_to_json;
use crate::source::UrlQuery;
use crate::TileCoord;

pub type PgResult<T> = Result<T, PgError>;

Expand All @@ -31,9 +31,6 @@ pub enum PgError {
#[error(transparent)]
RustlsError(#[from] rustls::Error),

#[error("Unable to install default Rustls provider: {0}")]
RustlsInstallDefaultFailed(String),

#[error("Unknown SSL mode: {0:?}")]
UnknownSslMode(deadpool_postgres::tokio_postgres::config::SslMode),

Expand Down
4 changes: 2 additions & 2 deletions martin/src/pg/pg_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ use deadpool_postgres::tokio_postgres::types::{ToSql, Type};
use log::debug;
use martin_tile_utils::Encoding::Uncompressed;
use martin_tile_utils::Format::Mvt;
use martin_tile_utils::TileInfo;
use martin_tile_utils::{TileCoord, TileInfo};
use tilejson::TileJSON;

use crate::pg::pool::PgPool;
use crate::pg::utils::query_to_json;
use crate::pg::PgError::{GetTileError, GetTileWithQueryError, PrepareQueryError};
use crate::source::{Source, TileData, UrlQuery};
use crate::{MartinResult, TileCoord};
use crate::MartinResult;

#[derive(Clone, Debug)]
pub struct PgSource {
Expand Down
4 changes: 2 additions & 2 deletions martin/src/pmtiles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::sync::Arc;

use async_trait::async_trait;
use log::{trace, warn};
use martin_tile_utils::{Encoding, Format, TileInfo};
use martin_tile_utils::{Encoding, Format, TileCoord, TileInfo};
use pmtiles::async_reader::AsyncPmTilesReader;
use pmtiles::cache::{DirCacheResult, DirectoryCache};
use pmtiles::reqwest::Client;
Expand All @@ -23,7 +23,7 @@ use crate::file_config::{ConfigExtras, FileError, FileResult, SourceConfigExtras
use crate::source::UrlQuery;
use crate::utils::cache::get_cached_value;
use crate::utils::{CacheKey, CacheValue, OptMainCache};
use crate::{MartinResult, Source, TileCoord, TileData};
use crate::{MartinResult, Source, TileData};

#[derive(Clone, Debug)]
pub struct PmtCache {
Expand Down
4 changes: 2 additions & 2 deletions martin/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use std::fmt::Debug;
use actix_web::error::ErrorNotFound;
use async_trait::async_trait;
use log::debug;
use martin_tile_utils::TileInfo;
use martin_tile_utils::{TileCoord, TileInfo};
use serde::{Deserialize, Serialize};
use tilejson::TileJSON;

use crate::{MartinResult, TileCoord};
use crate::MartinResult;

pub type TileData = Vec<u8>;
pub type UrlQuery = HashMap<String, String>;
Expand Down
4 changes: 2 additions & 2 deletions martin/src/srv/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ pub fn new_server(config: SrvConfig, state: ServerState) -> MartinResult<(Server
#[cfg(test)]
pub mod tests {
use async_trait::async_trait;
use martin_tile_utils::{Encoding, Format, TileInfo};
use martin_tile_utils::{Encoding, Format, TileCoord, TileInfo};
use tilejson::TileJSON;

use super::*;
use crate::source::{Source, TileData};
use crate::{TileCoord, UrlQuery};
use crate::UrlQuery;

#[derive(Debug, Clone)]
pub struct TestSource {
Expand Down
4 changes: 2 additions & 2 deletions martin/src/srv/tiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use actix_web::{route, HttpMessage, HttpRequest, HttpResponse, Result as ActixRe
use futures::future::try_join_all;
use log::trace;
use martin_tile_utils::{
decode_brotli, decode_gzip, encode_brotli, encode_gzip, Encoding, Format, TileInfo,
decode_brotli, decode_gzip, encode_brotli, encode_gzip, Encoding, Format, TileCoord, TileInfo,
};
use serde::Deserialize;

Expand All @@ -19,7 +19,7 @@ use crate::srv::server::map_internal_error;
use crate::srv::SrvConfig;
use crate::utils::cache::get_or_insert_cached_value;
use crate::utils::{CacheKey, CacheValue, MainCache, OptMainCache};
use crate::{Tile, TileCoord, TileData};
use crate::{Tile, TileData};

static SUPPORTED_ENC: &[HeaderEnc] = &[
HeaderEnc::gzip(),
Expand Down
3 changes: 2 additions & 1 deletion martin/src/utils/cache.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use moka::future::Cache;

use crate::{TileCoord, TileData};
use crate::TileData;

pub type MainCache = Cache<CacheKey, CacheValue>;
pub type OptMainCache = Option<MainCache>;
Expand Down Expand Up @@ -90,4 +90,5 @@ macro_rules! get_or_insert_cached_value {

#[cfg(feature = "pmtiles")]
pub(crate) use get_cached_value;
use martin_tile_utils::TileCoord;
pub(crate) use {from_cache_value, get_or_insert_cached_value, trace_cache};
1 change: 0 additions & 1 deletion martin/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ mod rectangle;
pub use rectangle::{append_rect, TileRect};

mod utilities;
pub use martin_tile_utils::TileCoord;
pub use utilities::*;
2 changes: 1 addition & 1 deletion martin/tests/pg_function_source_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use ctor::ctor;
use indoc::indoc;
use insta::assert_yaml_snapshot;
use martin::TileCoord;
use martin_tile_utils::TileCoord;

pub mod utils;
pub use utils::*;
Expand Down
2 changes: 1 addition & 1 deletion martin/tests/pg_table_source_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use ctor::ctor;
use indoc::indoc;
use insta::assert_yaml_snapshot;
use martin::TileCoord;

use martin_tile_utils::TileCoord;
pub mod utils;
pub use utils::*;

Expand Down

0 comments on commit d61e4b2

Please sign in to comment.