MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / checkpoint

Method checkpoint

app/src/API/Handlers/AssistantHandler.cpp:853–869  ·  view source on GitHub ↗

* @brief Force an immediate project snapshot with an optional caller-supplied label. */

Source from the content-addressed store, hash-verified

851 * @brief Force an immediate project snapshot with an optional caller-supplied label.
852 */
853API::CommandResponse API::Handlers::AssistantHandler::checkpoint(const QString& id,
854 const QJsonObject& params)
855{
856 const auto label = params.value(QStringLiteral("label")).toString();
857 const auto path = Misc::BackupManager::instance().snapshot(label);
858 if (path.isEmpty())
859 return CommandResponse::makeError(
860 id,
861 ErrorCode::ExecutionError,
862 QStringLiteral("Failed to write checkpoint (BackupManager disabled, no project loaded, "
863 "or the backup directory is unwritable)."));
864
865 QJsonObject result;
866 result[QStringLiteral("path")] = path;
867 result[QStringLiteral("label")] = label;
868 return CommandResponse::makeSuccess(id, result);
869}
870
871/**
872 * @brief Resolve a checkpoint reference (path / timestamp / label) to an absolute path.

Callers

nothing calls this directly

Calls 3

isEmptyMethod · 0.80
valueMethod · 0.45
snapshotMethod · 0.45

Tested by

no test coverage detected