pub trait Source: Send + Debug {
// Required methods
fn get_id(&self) -> &str;
fn get_tilejson(&self) -> &TileJSON;
fn get_tile_info(&self) -> TileInfo;
fn clone_source(&self) -> BoxedSource;
fn get_tile<'life0, 'life1, 'async_trait>(
&'life0 self,
xyz: TileCoord,
url_query: Option<&'life1 UrlQuery>,
) -> Pin<Box<dyn Future<Output = MartinCoreResult<TileData>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn get_version(&self) -> Option<String> { ... }
fn support_url_query(&self) -> bool { ... }
fn benefits_from_concurrent_scraping(&self) -> bool { ... }
fn is_valid_zoom(&self, zoom: u8) -> bool { ... }
fn get_catalog_entry(&self) -> CatalogSourceEntry { ... }
}
Expand description
Core trait for tile sources providing data to Martin
Implementors can serve tiles from databases, files, or other backends.
Required Methods§
Sourcefn get_tilejson(&self) -> &TileJSON
fn get_tilejson(&self) -> &TileJSON
TileJSON
specification served to clients.
Sourcefn get_tile_info(&self) -> TileInfo
fn get_tile_info(&self) -> TileInfo
Technical tile information (format, encoding, etc.).
Sourcefn clone_source(&self) -> BoxedSource
fn clone_source(&self) -> BoxedSource
Creates a boxed clone for trait object storage.
Sourcefn get_tile<'life0, 'life1, 'async_trait>(
&'life0 self,
xyz: TileCoord,
url_query: Option<&'life1 UrlQuery>,
) -> Pin<Box<dyn Future<Output = MartinCoreResult<TileData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_tile<'life0, 'life1, 'async_trait>(
&'life0 self,
xyz: TileCoord,
url_query: Option<&'life1 UrlQuery>,
) -> Pin<Box<dyn Future<Output = MartinCoreResult<TileData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves tile data for the given coordinates.
§Arguments
xyz
- Tile coordinates (x, y, zoom)url_query
- Optional query parameters for dynamic tiles
Provided Methods§
Sourcefn get_version(&self) -> Option<String>
fn get_version(&self) -> Option<String>
A version string for this source, if available. Default: None. If available, this string is appended to tile URLs as a query parameter, invalidating caches.
Sourcefn support_url_query(&self) -> bool
fn support_url_query(&self) -> bool
Whether this source accepts URL query parameters. Default: false.
Sourcefn benefits_from_concurrent_scraping(&self) -> bool
fn benefits_from_concurrent_scraping(&self) -> bool
Whether martin-cp should use concurrent scraping. Default: false.
Sourcefn is_valid_zoom(&self, zoom: u8) -> bool
fn is_valid_zoom(&self, zoom: u8) -> bool
Validates zoom level against TileJSON
min/max zoom constraints.
Sourcefn get_catalog_entry(&self) -> CatalogSourceEntry
fn get_catalog_entry(&self) -> CatalogSourceEntry
Generates catalog entry for this source.