Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add /refresh to update sources and some configurations #1179

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
e55909b
Changing all endpoint functions - catalog Data<Catalog>-> Data<Arc<Rw…
mesudBe-Orbit Feb 2, 2024
07cf109
server.rs: Removed mistakenly added repetition
mesudBe-Orbit Feb 6, 2024
a22c892
update var name - re-using the same var name
mesudBe-Orbit Feb 8, 2024
68906cf
Merge remote-tracking branch 'maplibre/main' into feature/dynamic-con…
sharkAndshark May 7, 2024
e1f447a
wip
sharkAndshark May 14, 2024
739a78f
wip
sharkAndshark May 15, 2024
425c4de
wip
sharkAndshark May 15, 2024
4702322
cargo fmt
sharkAndshark May 15, 2024
4614bf6
wip
sharkAndshark May 15, 2024
9c17ee6
cargo fmt
sharkAndshark May 15, 2024
ccc5443
use tokio::sync::RwLock instead
sharkAndshark May 15, 2024
bce06d9
clippy and fmt
sharkAndshark May 15, 2024
a4ddda9
wip
sharkAndshark May 26, 2024
d87d91d
wip
sharkAndshark May 28, 2024
4eee1c8
fmt and clippy
sharkAndshark May 28, 2024
ea294ab
Merge remote-tracking branch 'maplibre/main' into feature/dynamic-con…
sharkAndshark May 28, 2024
06cf46f
Add /refresh endpoint
sharkAndshark May 28, 2024
d333679
Merge remote-tracking branch 'maplibre/main' into feature/dynamic-con…
sharkAndshark May 29, 2024
c89e30a
just bless
sharkAndshark May 29, 2024
18046eb
wip
sharkAndshark May 30, 2024
1ccab28
wip
sharkAndshark May 30, 2024
3d47c80
wip
sharkAndshark May 31, 2024
f9776c9
wip
sharkAndshark May 31, 2024
0d24767
wip
sharkAndshark Jun 3, 2024
7440428
wip
sharkAndshark Jun 3, 2024
ab390db
wip
sharkAndshark Jun 4, 2024
20fb0d8
wip
sharkAndshark Jun 4, 2024
8ca8adf
wip
sharkAndshark Jun 4, 2024
af62c89
update test
sharkAndshark Jun 4, 2024
cd47c63
wip
sharkAndshark Jun 4, 2024
4e89bc6
wip
sharkAndshark Jun 4, 2024
de9003a
updae expected test results
sharkAndshark Jun 5, 2024
d002dd9
Merge remote-tracking branch 'maplibre/main' into feature/dynamic-con…
sharkAndshark Jun 5, 2024
7d635b1
revert tests
sharkAndshark Jun 5, 2024
c0a1700
update test
sharkAndshark Jun 5, 2024
f239bc4
fix test
sharkAndshark Jun 6, 2024
8e16b25
remove test-refresh.sh
sharkAndshark Jun 6, 2024
349a716
Add doc
sharkAndshark Jun 6, 2024
7f2da84
Add doc
sharkAndshark Jun 6, 2024
b9b6ed5
remove test.yml
sharkAndshark Jun 7, 2024
92e414c
Merge branch 'main' into feature/dynamic-config-reload
nyurik Jun 29, 2024
96de6f2
just fmt2
nyurik Jun 29, 2024
40da72a
a few cleanups, no logic changes yet
nyurik Jun 29, 2024
9960a0e
linting
nyurik Jun 29, 2024
e9f44c3
bump major version
nyurik Jun 30, 2024
dae0385
revert markdown changes
nyurik Jun 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions martin/src/srv/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use actix_web::web::Data;
use actix_web::{middleware, route, web, App, HttpResponse, HttpServer, Responder};
use log::error;
use serde::{Deserialize, Serialize};
use std::sync::{Arc, RwLock};

use crate::config::ServerState;
use crate::source::TileCatalog;
Expand Down Expand Up @@ -79,8 +80,9 @@ async fn get_health() -> impl Responder {
wrap = "middleware::Compress::default()"
)]
#[allow(clippy::unused_async)]
async fn get_catalog(catalog: Data<Catalog>) -> impl Responder {
HttpResponse::Ok().json(catalog)
async fn get_catalog(catalog: Data<Arc<RwLock<Catalog>>>) -> impl Responder {
let catalog_read = catalog.read().expect("Failed to acquire read lock on catalog");
HttpResponse::Ok().json(&*catalog_read)
mesudBe-Orbit marked this conversation as resolved.
Show resolved Hide resolved
}

pub fn router(cfg: &mut web::ServiceConfig) {
Expand All @@ -100,7 +102,9 @@ pub fn router(cfg: &mut web::ServiceConfig) {

/// Create a new initialized Actix `App` instance together with the listening address.
pub fn new_server(config: SrvConfig, state: ServerState) -> MartinResult<(Server, String)> {
let catalog = Catalog::new(&state)?;
let catalog = Arc::new(RwLock::new(Catalog::new(&state)?));


let keep_alive = Duration::from_secs(config.keep_alive.unwrap_or(KEEP_ALIVE_DEFAULT));
let worker_processes = config.worker_processes.unwrap_or_else(num_cpus::get);
let listen_addresses = config
Expand Down
45 changes: 45 additions & 0 deletions test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
postgres:
connection_string: postgresql://admin:test@localhost:5433/geometries?
auto_publish: true
tables:
MixPoints:
schema: MixedCase
table: MixPoints
srid: 4326
geometry_column: Geom
bounds:
- -170.94984639004662
- -84.20025580733805
- 167.70892858284475
- 74.23573284753762
geometry_type: POINT
properties:
Gid: int4
TABLE: text
points1:
schema: public
table: points1
srid: 4326
geometry_column: geom
bounds:
- -179.27313970132585
- -67.52518563265659
- 162.60117193735186
- 84.93092095128937
geometry_type: POINT
properties:
gid: int4
points1_vw:
schema: public
table: points1_vw
srid: 4326
geometry_column: geom
bounds:
- -179.27313970132585
- -67.52518563265659
- 162.60117193735186
- 84.93092095128937
geometry_type: POINT
properties:
gid: int4
functions: {}