diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-11-20 15:17:26 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-12-10 16:44:55 +0200 |
commit | 475771f84d3fb6197fea772d67e5a59c46b512e5 (patch) | |
tree | d3a80f655cb0261d5cfd5728a5159e064050320c /libbrep | |
parent | 40a3855e2341529624050b4324e73e774967111a (diff) |
Add support for tenant service reference count
Diffstat (limited to 'libbrep')
-rw-r--r-- | libbrep/build-extra.sql | 1 | ||||
-rw-r--r-- | libbrep/build.hxx | 2 | ||||
-rw-r--r-- | libbrep/build.xml | 2 | ||||
-rw-r--r-- | libbrep/common.hxx | 7 | ||||
-rw-r--r-- | libbrep/package.hxx | 2 | ||||
-rw-r--r-- | libbrep/package.xml | 6 |
6 files changed, 17 insertions, 3 deletions
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 @@ <changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" schema-name="build" version="1"> + <changeset version="29"/> + <model version="28"> <table name="build" kind="object"> <column name="package_tenant" type="TEXT" null="false"/> 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<string> data; tenant_service () = default; tenant_service (string i, string t, optional<string> 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 @@ <changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" schema-name="package" version="1"> + <changeset version="36"> + <alter-table name="tenant"> + <add-column name="service_ref_count" type="BIGINT" null="true"/> + </alter-table> + </changeset> + <changeset version="35"> <alter-table name="package"> <add-column name="reviews_pass" type="BIGINT" null="true"/> |