aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/hub/httphubservice.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2026-04-08 13:51:46 +0200
committerGitHub Enterprise <[email protected]>2026-04-08 13:51:46 +0200
commit289d66d7b54f0560253a2a4eb27bf697ad62fa83 (patch)
tree59de8d951575c9ef6cbf597fce061ddc4ce71ef1 /src/zenserver/hub/httphubservice.cpp
parentsort items on dashboard (#924) (diff)
downloadzen-289d66d7b54f0560253a2a4eb27bf697ad62fa83.tar.xz
zen-289d66d7b54f0560253a2a4eb27bf697ad62fa83.zip
hydration data obliteration (#923)
- Feature: Hub obliterate operation deletes all local and backend hydration data for a module - Improvement: Hub dashboard adds obliterate button for individual, bulk, and by-name module deletion
Diffstat (limited to 'src/zenserver/hub/httphubservice.cpp')
-rw-r--r--src/zenserver/hub/httphubservice.cpp39
1 files changed, 6 insertions, 33 deletions
diff --git a/src/zenserver/hub/httphubservice.cpp b/src/zenserver/hub/httphubservice.cpp
index eba816793..e6a900066 100644
--- a/src/zenserver/hub/httphubservice.cpp
+++ b/src/zenserver/hub/httphubservice.cpp
@@ -389,45 +389,18 @@ HttpHubService::HandleModuleGet(HttpServerRequest& Request, std::string_view Mod
void
HttpHubService::HandleModuleDelete(HttpServerRequest& Request, std::string_view ModuleId)
{
- Hub::InstanceInfo InstanceInfo;
- if (!m_Hub.Find(ModuleId, &InstanceInfo))
- {
- Request.WriteResponse(HttpResponseCode::NotFound);
- return;
- }
+ Hub::Response Resp = m_Hub.Obliterate(std::string(ModuleId));
- if (InstanceInfo.State == HubInstanceState::Provisioned || InstanceInfo.State == HubInstanceState::Hibernated ||
- InstanceInfo.State == HubInstanceState::Crashed)
+ if (HandleFailureResults(Request, Resp))
{
- try
- {
- Hub::Response Resp = m_Hub.Deprovision(std::string(ModuleId));
-
- if (HandleFailureResults(Request, Resp))
- {
- return;
- }
-
- // TODO: nuke all related storage
-
- const HttpResponseCode HttpCode =
- (Resp.ResponseCode == Hub::EResponseCode::Accepted) ? HttpResponseCode::Accepted : HttpResponseCode::OK;
- CbObjectWriter Obj;
- Obj << "moduleId" << ModuleId;
- return Request.WriteResponse(HttpCode, Obj.Save());
- }
- catch (const std::exception& Ex)
- {
- ZEN_ERROR("Exception while deprovisioning module '{}': {}", ModuleId, Ex.what());
- throw;
- }
+ return;
}
- // TODO: nuke all related storage
-
+ const HttpResponseCode HttpCode =
+ (Resp.ResponseCode == Hub::EResponseCode::Accepted) ? HttpResponseCode::Accepted : HttpResponseCode::OK;
CbObjectWriter Obj;
Obj << "moduleId" << ModuleId;
- Request.WriteResponse(HttpResponseCode::OK, Obj.Save());
+ Request.WriteResponse(HttpCode, Obj.Save());
}
void