pub(crate) mod sources; pub(crate) mod coords; mod grib2; mod pixmap; use std::borrow::Cow; use std::collections::{BTreeMap, HashMap}; use std::env::args; use std::fs::File; use std::io::BufReader; use tokio::sync::RwLock; use std::time::SystemTime; use actix_web::{App, get, HttpServer}; use actix_web::web::Data; use grib::codetables::{CodeTable1_4, CodeTable4_2, CodeTable4_3, Lookup}; use grib::{GribError, SectionBody}; use ordered_float::OrderedFloat; use crate::grib2::GriddedLookupTable; use crate::sources::noaa::mrms_cref; #[global_allocator] static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; #[repr(usize)] #[derive(Ord, PartialOrd, Eq, PartialEq, Debug, Clone)] pub enum LutKey { NoaaMrmsCref = 1 } pub struct AppState { lut_cache: RwLock>, lut_cache_timestamps: RwLock> } #[actix_web::main] async fn main() -> std::io::Result<()> { let data = Data::new(AppState { lut_cache: RwLock::new(BTreeMap::new()), lut_cache_timestamps: RwLock::new(BTreeMap::new()) }); HttpServer::new(move || { App::new() .service(mrms_cref) .app_data(data.clone()) }) .bind(("127.0.0.1", 8080))? .run() .await }