Function svc_telemetry::rest::server::rest_server
source · pub async fn rest_server(
config: Config,
grpc_clients: GrpcClients,
ring: Arc<Mutex<VecDeque<AircraftPosition>>>,
shutdown_rx: Option<Receiver<()>>
) -> Result<(), ()>
Expand description
Starts the REST API server for this microservice
Example:
use svc_telemetry::rest::server::rest_server;
use svc_telemetry::grpc::client::GrpcClients;
use svc_gis_client_grpc::client::AircraftPosition;
use svc_telemetry::Config;
use std::collections::VecDeque;
use std::sync::{Arc, Mutex};
async fn example() -> Result<(), tokio::task::JoinError> {
let config = Config::default();
let ring = Arc::new(Mutex::new(VecDeque::<AircraftPosition>::with_capacity(10)));
let grpc_clients = GrpcClients::default(config.clone());
tokio::spawn(rest_server(config, grpc_clients, ring, None)).await;
Ok(())
}