ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
edits.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Povl Filip Sonne-Frederiksen
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
6
7// The mutating half of the GUI API (#265, Phase 4).
8//
9// Kept apart from gui/api.hpp deliberately. Everything there takes a
10// `const ProjectDB &` and is a pure function of the stored project; everything
11// here takes a writable one and changes it. That split is the reason the
12// read side can keep its "open a fresh read-only connection per request"
13// guarantee without qualification.
14//
15// WRITER DISCIPLINE. `rux gui` has exactly two writers: the pipeline job
16// worker and these handlers. They exclude each other through the project's
17// writer lock, which the JobRunner owns
18// (pipeline::JobRunner::try_acquire_writer) and holds for the whole of every
19// stage. A handler that cannot take the lock answers 503 rather than waiting,
20// and a handler asked to write while a job is queued or running answers 409
21// rather than interleaving with it.
22//
23// This matters beyond tidiness: both edits below are read-modify-writes.
24// Renaming one label class rewrites the cloud's entire label map, because
25// ProjectDB::save_label_definitions replaces it wholesale. Two unsynchronised
26// writers would lose one of the renames with no error anywhere.
27
28#include <nlohmann/json_fwd.hpp>
29
30#include <string>
31
32namespace reusex {
33class ProjectDB;
34}
35
36namespace rux::gui {
37
52 const std::string &name,
53 const std::string &body);
54
64nlohmann::json patch_material(reusex::ProjectDB &db, const std::string &guid,
65 const std::string &body);
66
67} // namespace rux::gui
nlohmann::json patch_cloud_labels(reusex::ProjectDB &db, const std::string &name, const std::string &body)
Rename label classes of one Label cloud.
nlohmann::json patch_material(reusex::ProjectDB &db, const std::string &guid, const std::string &body)
Add, change or clear properties of one material passport.