crates/korp-map-wire/src/lib.rs
//! **korp map wire, contract v1** (summarised in the repository README).
//!
//! One producer, two doors:
//!
//! * [`MapSource`] answers `regions()` and `query(region, bbox, lod, kind, max)` with an
//! Arrow schema and a stream of record batches. The batches are the GeoParquet 1.1
//! **native** rows osm-katana exports (`<table>.point|multilinestring|multipolygon.parquet`),
//! column for column, so facett-osm's native decoder reads a reply as it reads a file.
//! * The HTTP door ([`http`]) serves `GET /v1/health`, `GET /v1/regions` and
//! `GET /v1/map/{kind}` as an Arrow IPC stream, and the address lookups
//! `GET /v1/geocode` and `GET /v1/revgeocode` as JSON ([`geocode`], contract v1.2);
//! errors are JSON with a `korp-map-<n>` code.
//! * The Flight door ([`flight`]) serves `DoGet` (ticket = the same query as JSON) and
//! `ListFlights` (the regions).
//!
//! [`server::serve`] puts both doors on one port: gRPC requests (`content-type:
//! application/grpc…`) go to Flight, everything else to HTTP.
//!
//! With feature `tls`, [`server::serve_tls`] serves the same doors over HTTPS ([`tls`]:
//! rustls on ring, a certificate from PEM files or, with feature `acme`, from Let's
//! Encrypt over TLS-ALPN-01).
//!
//! [`FileSource`] is the file-backed source: it reads native files from a directory and
//! answers a bbox query from the `bbox` covering column, pruned by row-group statistics.
//! It is the fake the tests and the Streamlit client use until korp-map's store exists.
//!
//! The reply's `data_version`, `truncated`, `row_groups_total`, `row_groups_scanned`,
//! `status` and `geometry_source` ride in the Arrow **schema** metadata (keys in
//! [`source::meta_keys`]). A source plans the whole read before the first batch, so all
//! are known when the schema is written. (arrow-rs 59 has no writer for per-batch IPC
//! message metadata.)
//!
//! Contract v1.1: a reply carries `id`, `tags`, `min_zoom` and ONE `geometry` column —
//! the coarsest stored geometry exact enough for the `lod` — and `points` are tagged
//! nodes only.
pub mod cache;
#[cfg(feature = "client")]
pub mod client;
pub mod encoding;
pub mod error;
pub mod file_source;
pub mod files;
pub mod fixture;
pub mod flight;
pub mod geoarrow;
pub mod geocode;
pub mod http;
pub mod ipc;
pub mod landing;
pub mod openapi;
pub mod server;
pub mod source;
#[cfg(feature = "tls")]
pub mod tls;
#[cfg(feature = "client")]
pub use client::{
ClientReply, FakeMapClient, FlightMapClient, HttpMapClient, MapClient, SourceClient,
};
pub use encoding::ContentEncoding;
pub use error::{Code, TlsCode, TlsError, WireError};
pub use file_source::FileSource;
pub use geocode::{GeocodeHit, GeocodeQuery, GeocodeReply, RevGeocodeQuery, RevGeocodeReply};
pub use ipc::Compression;
#[cfg(feature = "tls")]
pub use server::serve_tls;
pub use server::{ServerConfig, serve};
pub use source::{BBox, Kind, MapQuery, MapReply, MapSource, Region, ReplyMeta};