Add /cluster/db/map/reallocate for retrieving the current reallocation jobs

This commit is contained in:
Ingo Oppermann
2025-09-15 12:09:56 +02:00
parent b359a4e920
commit 852b836f7e
4 changed files with 21 additions and 3 deletions

View File

@@ -108,6 +108,8 @@ type ClusterKVS map[string]ClusterKVSValue
type ClusterProcessMap map[string]string
type ClusterProcessRelocateMap map[string]string
type ClusterProcessReallocate struct {
TargetNodeID string `json:"target_node_id"`
Processes []ProcessID `json:"process_ids"`

View File

@@ -247,8 +247,8 @@ func (h *ClusterHandler) GetSnapshot(c echo.Context) error {
}
// Reallocation issues reallocation requests of processes
// @Summary Retrieve snapshot of the cluster DB
// @Description Retrieve snapshot of the cluster DB
// @Summary Issue reallocation requests of processes
// @Description Issue reallocation requests of processes
// @Tags v16.?.?
// @ID cluster-3-reallocation
// @Produce json

View File

@@ -86,13 +86,28 @@ func (h *ClusterHandler) StoreGetProcess(c echo.Context) error {
// @Produce json
// @Success 200 {object} api.ClusterProcessMap
// @Security ApiKeyAuth
// @Router /api/v3/cluster/map/process [get]
// @Router /api/v3/cluster/db/map/process [get]
func (h *ClusterHandler) StoreGetProcessNodeMap(c echo.Context) error {
m := h.cluster.Store().ProcessGetNodeMap()
return c.JSON(http.StatusOK, m)
}
// StoreGetProcessRelocateMap returns a map of which processes should be relocated
// @Summary Retrieve a map of which processes should be relocated
// @Description Retrieve a map of which processes should be relocated
// @Tags v16.?.?
// @ID cluster-3-db-process-relocate-map
// @Produce json
// @Success 200 {object} api.ClusterProcessRelocateMap
// @Security ApiKeyAuth
// @Router /api/v3/cluster/db/map/reallocate [get]
func (h *ClusterHandler) StoreGetProcessRelocateMap(c echo.Context) error {
m := h.cluster.Store().ProcessGetRelocateMap()
return c.JSON(http.StatusOK, m)
}
// StoreListIdentities returns the list of identities stored in the DB of the cluster
// @Summary List of identities in the cluster
// @Description List of identities in the cluster

View File

@@ -742,6 +742,7 @@ func (s *server) setRoutesV3(v3 *echo.Group) {
v3.GET("/cluster/db/locks", s.v3handler.cluster.StoreListLocks)
v3.GET("/cluster/db/kv", s.v3handler.cluster.StoreListKV)
v3.GET("/cluster/db/map/process", s.v3handler.cluster.StoreGetProcessNodeMap)
v3.GET("/cluster/db/map/reallocate", s.v3handler.cluster.StoreGetProcessRelocateMap)
v3.GET("/cluster/db/node", s.v3handler.cluster.StoreListNodes)
v3.GET("/cluster/iam/user", s.v3handler.cluster.IAMIdentityList)