Rename orchestration, splice and routes: a Renamer runs one rename at a time, closing the gate, taking the controller lock and holding the engine, each waiting without a limit and saying what it waits for (summary rename status, rename_waiting); DELETE on the pending request or a closed connection calls it off until the journal begins (409 aborted); then journal, steps and audit, retried in the background on failure (503 completing); splice_renamed rebuilds the affected flows under the held lock keeping stopped, paused and parked work, history limits and device wiring refreshed before activation; AlertManager.rename and EventBus.rename/settle follow the names; flow and dashboard rename routes answer by code and repeat stored results; renamed, dashboard_changed and pipeline_rebuilt after release; fluksio serve reads flow files without building a FlowStore

This commit is contained in:
2026-11-02 22:14:44 +01:00
parent 2d65118d82
commit ba4aae390d
16 changed files with 2174 additions and 22 deletions
+35 -2
View File
@@ -7,7 +7,7 @@ label unique among dashboards and what ``GET /dashboards?name=`` looks up.
import time
from typing import Any
from fastapi import APIRouter, Depends, HTTPException
from fastapi import APIRouter, Depends, HTTPException, Request
from fastapi.concurrency import run_in_threadpool
from pydantic import BaseModel
@@ -15,6 +15,7 @@ from fluksio.api.deps import (
CurrentUser,
DashboardStoreDep,
FlowControllerDep,
RenamerDep,
check_pin,
get_current_active_superuser,
get_current_user,
@@ -30,7 +31,13 @@ from fluksio.flow.dashboards import (
results_dashboard,
)
from fluksio.flow.events import event_bus
from fluksio.flow.rename import RenamePlan, RenamePlanRequest, plan_rename
from fluksio.flow.rename import (
RenamePlan,
RenamePlanRequest,
RenameRequest,
RenameResult,
plan_rename,
)
from fluksio.flow.store import FlowNotFound, IdTaken, StaleVersion
from fluksio.models import Message
@@ -279,3 +286,29 @@ async def plan_dashboard_rename(
)
except DashboardNotFound:
raise _missing(dashboard_id)
@router.post(
"/{dashboard_id}/rename",
response_model=RenameResult,
dependencies=[Depends(get_current_active_superuser)],
)
async def rename_dashboard(
dashboard_id: str,
body: RenameRequest,
request: Request,
renamer: RenamerDep,
user: CurrentUser,
) -> Any:
"""Rename this dashboard's key, as its plan described it.
Its two documents and nothing else: devices list it by id, and nothing
binds to it by key. The same ``request_id`` again gets the same answer;
refusals are as for a flow.
"""
try:
return await renamer.rename(
"dashboard", dashboard_id, body, user.email, request.is_disconnected
)
except DashboardNotFound:
raise _missing(dashboard_id)