Skip to content

Commit

Permalink
updated administration service to metadataservice
Browse files Browse the repository at this point in the history
  • Loading branch information
dutchie032 committed Sep 24, 2024
1 parent e4b2791 commit eff3537
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 43 deletions.
2 changes: 1 addition & 1 deletion protos/dcs/dcs.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ syntax = "proto3";

package dcs;

import "dcs/administration/v0/administration.proto";
import "dcs/atmosphere/v0/atmosphere.proto";
import "dcs/coalition/v0/coalition.proto";
import "dcs/common/v0/common.proto";
import "dcs/controller/v0/controller.proto";
import "dcs/custom/v0/custom.proto";
import "dcs/group/v0/group.proto";
import "dcs/hook/v0/hook.proto";
import "dcs/metadata/v0/metadata.proto";
import "dcs/mission/v0/mission.proto";
import "dcs/net/v0/net.proto";
import "dcs/srs/v0/srs.proto";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
syntax = "proto3";
package dcs.administration.v0;
option csharp_namespace = "RurouniJones.Dcs.Grpc.V0.Administration";
option go_package = "github.com/DCS-gRPC/go-bindings/dcs/v0/administration";
package dcs.metadata.v0;
option csharp_namespace = "RurouniJones.Dcs.Grpc.V0.Metadata";
option go_package = "github.com/DCS-gRPC/go-bindings/dcs/v0/metadata";

//A service to get administrative data like health and version
service AdministrationService {
//A service to get administrative/meta data like server health checks and version
service MetadataService {

rpc GetHealth(GetHealthRequest) returns (GetHealthResponse) {}

Expand Down
2 changes: 1 addition & 1 deletion src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ pub use self::srs::Srs;
use crate::shutdown::ShutdownHandle;
use crate::stats::Stats;

mod administration;
mod atmosphere;
mod coalition;
mod controller;
mod custom;
mod group;
mod hook;
mod metadata;
mod mission;
mod net;
mod srs;
Expand Down
30 changes: 0 additions & 30 deletions src/rpc/administration.rs

This file was deleted.

26 changes: 26 additions & 0 deletions src/rpc/metadata.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use stubs::metadata::v0::metadata_service_server::MetadataService;
use stubs::*;
use tonic::async_trait;
use tonic::{Request, Response, Status};

use super::MissionRpc;

#[async_trait]
impl MetadataService for MissionRpc {
async fn get_health(
&self,
_request: Request<metadata::v0::GetHealthRequest>,
) -> Result<Response<metadata::v0::GetHealthResponse>, Status> {
let alive: bool = true;
return Ok(Response::new(metadata::v0::GetHealthResponse { alive }));
}

async fn get_version(
&self,
_request: Request<metadata::v0::GetVersionRequest>,
) -> Result<Response<metadata::v0::GetVersionResponse>, Status> {
const VERSION: Option<&str> = option_env!("CARGO_PKG_VERSION");
let version = VERSION.unwrap_or("unknown").to_string();
return Ok(Response::new(metadata::v0::GetVersionResponse { version }));
}
}
4 changes: 2 additions & 2 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ use std::time::Duration;

use dcs_module_ipc::IPC;
use futures_util::FutureExt;
use stubs::administration::v0::administration_service_server::AdministrationServiceServer;
use stubs::atmosphere::v0::atmosphere_service_server::AtmosphereServiceServer;
use stubs::coalition::v0::coalition_service_server::CoalitionServiceServer;
use stubs::controller::v0::controller_service_server::ControllerServiceServer;
use stubs::custom::v0::custom_service_server::CustomServiceServer;
use stubs::group::v0::group_service_server::GroupServiceServer;
use stubs::hook::v0::hook_service_server::HookServiceServer;
use stubs::metadata::v0::metadata_service_server::MetadataServiceServer;
use stubs::mission::v0::mission_service_server::MissionServiceServer;
use stubs::mission::v0::StreamEventsResponse;
use stubs::net::v0::net_service_server::NetServiceServer;
Expand Down Expand Up @@ -244,13 +244,13 @@ async fn try_run(
});

transport::Server::builder()
.add_service(AdministrationServiceServer::new(mission_rpc.clone()))
.add_service(AtmosphereServiceServer::new(mission_rpc.clone()))
.add_service(CoalitionServiceServer::new(mission_rpc.clone()))
.add_service(ControllerServiceServer::new(mission_rpc.clone()))
.add_service(CustomServiceServer::new(mission_rpc.clone()))
.add_service(GroupServiceServer::new(mission_rpc.clone()))
.add_service(HookServiceServer::new(hook_rpc))
.add_service(MetadataServiceServer::new(mission_rpc.clone()))
.add_service(MissionServiceServer::new(mission_rpc.clone()))
.add_service(NetServiceServer::new(mission_rpc.clone()))
.add_service(TimerServiceServer::new(mission_rpc.clone()))
Expand Down
3 changes: 0 additions & 3 deletions stubs/src/administration.rs

This file was deleted.

2 changes: 1 addition & 1 deletion stubs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
#![allow(clippy::derive_partial_eq_without_eq)]
#![allow(clippy::large_enum_variant)]

pub mod administration;
pub mod atmosphere;
pub mod coalition;
pub mod common;
pub mod controller;
pub mod custom;
pub mod group;
pub mod hook;
pub mod metadata;
pub mod mission;
pub mod net;
pub mod srs;
Expand Down
3 changes: 3 additions & 0 deletions stubs/src/metadata.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub mod v0 {
tonic::include_proto!("dcs.metadata.v0");
}

0 comments on commit eff3537

Please sign in to comment.