Module service

Module service 

Source
Expand description

Business logic layer — orchestrates backend calls and enforces domain rules for every resource type exposed by the CLI and HTTP server.

§Position in the layering

Sits between crate::server (HTTP handlers) and crate::backend_dispatcher (CSM / OCHAMI dispatch). Per CLAUDE.md’s boundary rule, handlers MUST only call functions in this module; they never reach the backend dispatcher directly. The service layer in turn calls backend trait methods on the InfraContext’s backend field, which routes to the active crate::dispatcher::StaticBackendDispatcher variant.

§Conventions

  • Every public async function takes a &InfraContext<'_> and a token: &str so authorization can run before any backend call.
  • All fallible paths return [manta_backend_dispatcher::error::Error]; the handler layer maps these to HTTP responses through to_handler_error.
  • Authorization helpers in authorization are called from every function that takes a node, group, or session name from the caller — including read-only endpoints, so listings can’t leak resources the caller couldn’t have queried directly.

§Module map

Modules§

analysis
Cross-resource analyses that fan IMS / CFS / BSS fetches and link the results in a pure helper.
auth
Authentication service — proxies CLI credential exchange to the configured CSM/OCHAMI backend.
authorization
Authorization helpers: validate user access to HSM groups and their members.
boot_parameters
BSS boot parameter queries, changeset preparation, and persistence.
cluster
Cluster-scoped node detail queries using HSM group membership.
configuration
CFS configuration queries, layer-detail lookups, and cascading deletion of all dependent resources (sessions, BOS templates, IMS images).
console
Console-attach service wrappers.
ephemeral_env
Ephemeral CFS environment provisioning — launches a temporary IMS customize container booted from an existing IMS image and returns its SSH hostname.
group
HSM group CRUD operations and membership management.
hardware
Hardware inventory queries for individual nodes and clusters.
hw_cluster
Hardware-cluster pin/unpin and hw-component add/delete service logic.
image
IMS image queries and safety-checked deletion.
ims_ops
IMS image helpers shared by handlers that need to locate or cross-reference images by CFS configuration name (e.g. boot-config application, SAT-file rendering).
infra_backend
Dispatcher-meta methods on InfraContext.
kernel_parameters
Kernel boot parameter mutations (add, apply, delete) with SBPS iSCSI image projection.
migrate
Node migration between HSM groups.
node
HSM node queries, registration, and deletion, with rollback on partial failure.
node_details
Per-xname NodeDetails aggregation built from the backend dispatcher.
node_ops
Node-expression resolution: parsing hostlist strings, NID-to-xname translation, HSM-group expansion, and the authorization helpers that validate the caller can act on the resolved set.
power
Power on/off/reset operations against PCS.
redfish
HSM Redfish-endpoint registry queries and CRUD.
sat_file
SAT-file service wrappers.
sat_groups
SAT-entry → HSM group-name extractors.
session
CFS session queries, creation, deletion, and console-readiness validation.
template
BOS session template queries and BOS session creation with access validation.