From bad54b28bcc59fe5d19ecaf486f52e6359009e68 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 21 May 2024 13:48:43 +0300 Subject: Add support for build_unloaded() notification for tenant-associated services --- mod/ci-common.hxx | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'mod/ci-common.hxx') diff --git a/mod/ci-common.hxx b/mod/ci-common.hxx index 6f62c4b..45c959a 100644 --- a/mod/ci-common.hxx +++ b/mod/ci-common.hxx @@ -36,6 +36,7 @@ namespace brep package_name name; optional version; }; + // Note that the inability to generate the reference is an internal // error. Thus, it is not optional. // @@ -62,7 +63,47 @@ namespace brep const optional& interactive = nullopt, const optional& simulate = nullopt, const vector>& custom_request = {}, - const vector>& overrides = {}); + const vector>& overrides = {}) const; + + // Create an unloaded CI request returning start_result::reference on + // success and nullopt on an internal error. Such a request is not started + // until loaded with the load() function below. See also the + // build_unloaded() tenant services notification. + // + // Note: should be called out of the database transaction. + // + optional + create (const basic_mark& error, + const basic_mark& warn, + const basic_mark* trace, + odb::core::database&, + tenant_service&&) const; + + // Load (and start) previously created (as unloaded) CI request. Similarly + // to the start() function, return nullopt on an internal error. + // + // Note that tenant_service::id is used to identify the CI request tenant. + // + // Note: should be called out of the database transaction. + // + optional + load (const basic_mark& error, + const basic_mark& warn, + const basic_mark* trace, + odb::core::database&, + tenant_service&&, + const repository_location& repository) const; + + // Abandon previously created (as unloaded) CI request. + // + // Note: should be called out of the database transaction. + // + void + abandon (const basic_mark& error, + const basic_mark& warn, + const basic_mark* trace, + odb::core::database&, + tenant_service&&) const; // Helpers. // -- cgit v1.1