Mountain/RPC/CocoonService/Command/
UnregisterCommand.rs1#![allow(non_snake_case)]
2
3use CommonLibrary::Command::CommandExecutor::CommandExecutor;
6use tonic::{Response, Status};
7
8use crate::{
9 RPC::CocoonService::CocoonServiceImpl,
10 Vine::Generated::{Empty, UnregisterCommandRequest},
11 dev_log,
12};
13
14pub async fn Fn(Service:&CocoonServiceImpl, Request:UnregisterCommandRequest) -> Result<Response<Empty>, Status> {
15 dev_log!("cocoon", "[CocoonService] Unregistering command '{}'", Request.command_id);
16 if let Err(Error) = Service
17 .environment
18 .UnregisterCommand(String::new(), Request.command_id.clone())
19 .await
20 {
21 dev_log!(
22 "cocoon",
23 "warn: [CocoonService] Failed to unregister command '{}': {:?}",
24 Request.command_id,
25 Error
26 );
27 } else {
28 dev_log!("cocoon", "[CocoonService] Command removed: {}", Request.command_id);
29 }
30 Ok(Response::new(Empty {}))
31}