Mountain/RPC/CocoonService/Command/
UnregisterCommand.rs1
2use CommonLibrary::Command::CommandExecutor::CommandExecutor;
5use tonic::{Response, Status};
6
7use crate::{
8 RPC::CocoonService::CocoonServiceImpl,
9 Vine::Generated::{Empty, UnregisterCommandRequest},
10 dev_log,
11};
12
13pub async fn Fn(Service:&CocoonServiceImpl, Request:UnregisterCommandRequest) -> Result<Response<Empty>, Status> {
14 dev_log!("cocoon", "[CocoonService] Unregistering command '{}'", Request.command_id);
15
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
31 Ok(Response::new(Empty {}))
32}