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
17 if let Err(Error) = Service
18 .environment
19 .UnregisterCommand(String::new(), Request.command_id.clone())
20 .await
21 {
22 dev_log!(
23 "cocoon",
24 "warn: [CocoonService] Failed to unregister command '{}': {:?}",
25 Request.command_id,
26 Error
27 );
28 } else {
29 dev_log!("cocoon", "[CocoonService] Command removed: {}", Request.command_id);
30 }
31
32 Ok(Response::new(Empty {}))
33}