mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-15 04:00:38 +00:00
## Problem We want to use safekeeper http client in storage controller and neon_local. ## Summary of changes Extract it to separate crate. No functional changes.
22 lines
618 B
Rust
22 lines
618 B
Rust
pub mod routes;
|
|
pub use routes::make_router;
|
|
|
|
pub use safekeeper_api::models;
|
|
use std::sync::Arc;
|
|
|
|
use crate::{GlobalTimelines, SafeKeeperConf};
|
|
|
|
pub async fn task_main(
|
|
conf: Arc<SafeKeeperConf>,
|
|
http_listener: std::net::TcpListener,
|
|
global_timelines: Arc<GlobalTimelines>,
|
|
) -> anyhow::Result<()> {
|
|
let router = make_router(conf, global_timelines)
|
|
.build()
|
|
.map_err(|err| anyhow::anyhow!(err))?;
|
|
let service = utils::http::RouterService::new(router).unwrap();
|
|
let server = hyper::Server::from_tcp(http_listener)?;
|
|
server.serve(service).await?;
|
|
Ok(()) // unreachable
|
|
}
|