From 475771f84d3fb6197fea772d67e5a59c46b512e5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 20 Nov 2024 15:17:26 +0200 Subject: Add support for tenant service reference count --- libbrep/build-extra.sql | 1 + libbrep/build.hxx | 2 +- libbrep/build.xml | 2 ++ libbrep/common.hxx | 7 ++++++- libbrep/package.hxx | 2 +- libbrep/package.xml | 6 ++++++ 6 files changed, 17 insertions(+), 3 deletions(-) (limited to 'libbrep') diff --git a/libbrep/build-extra.sql b/libbrep/build-extra.sql index 0c0f010..3134fbb 100644 --- a/libbrep/build-extra.sql +++ b/libbrep/build-extra.sql @@ -50,6 +50,7 @@ CREATE FOREIGN TABLE build_tenant ( archived BOOLEAN NOT NULL, service_id TEXT NULL, service_type TEXT NULL, + service_ref_count BIGINT NULL, service_data TEXT NULL, unloaded_timestamp BIGINT NULL, unloaded_notify_interval BIGINT NULL, diff --git a/libbrep/build.hxx b/libbrep/build.hxx index b485636..5ebbb0c 100644 --- a/libbrep/build.hxx +++ b/libbrep/build.hxx @@ -28,7 +28,7 @@ // #define LIBBREP_BUILD_SCHEMA_VERSION_BASE 28 -#pragma db model version(LIBBREP_BUILD_SCHEMA_VERSION_BASE, 28, closed) +#pragma db model version(LIBBREP_BUILD_SCHEMA_VERSION_BASE, 29, closed) // We have to keep these mappings at the global scope instead of inside the // brep namespace because they need to be also effective in the bbot namespace diff --git a/libbrep/build.xml b/libbrep/build.xml index d58e5f4..284db49 100644 --- a/libbrep/build.xml +++ b/libbrep/build.xml @@ -1,4 +1,6 @@ + + diff --git a/libbrep/common.hxx b/libbrep/common.hxx index d2009f5..22302f3 100644 --- a/libbrep/common.hxx +++ b/libbrep/common.hxx @@ -543,17 +543,22 @@ namespace brep // // Note that the {id, type} pair must be unique. // + // The reference count is used to keep track of the number of attempts to + // create a duplicate tenant with this {id, type} (see ci_start::create() + // for details). + // #pragma db value struct tenant_service { string id; string type; + uint64_t ref_count; optional data; tenant_service () = default; tenant_service (string i, string t, optional d = nullopt) - : id (move (i)), type (move (t)), data (move (d)) {} + : id (move (i)), type (move (t)), ref_count (1), data (move (d)) {} }; // Version comparison operators. diff --git a/libbrep/package.hxx b/libbrep/package.hxx index 79b2c68..2714d10 100644 --- a/libbrep/package.hxx +++ b/libbrep/package.hxx @@ -20,7 +20,7 @@ // #define LIBBREP_PACKAGE_SCHEMA_VERSION_BASE 34 -#pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 35, closed) +#pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 36, closed) namespace brep { diff --git a/libbrep/package.xml b/libbrep/package.xml index 8b6c706..ac48ec4 100644 --- a/libbrep/package.xml +++ b/libbrep/package.xml @@ -1,4 +1,10 @@ + + + + + + -- cgit v1.1