From d4900d85f7a5d791f89821713d02d3dd19361044 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 22 Feb 2024 11:17:25 +0300 Subject: Add support for tenant-associated service notifications --- libbrep/common.hxx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'libbrep/common.hxx') diff --git a/libbrep/common.hxx b/libbrep/common.hxx index fec22e8..11aae67 100644 --- a/libbrep/common.hxx +++ b/libbrep/common.hxx @@ -127,6 +127,20 @@ namespace brep std::chrono::duration_cast ( \ std::chrono::nanoseconds (?)))) + using optional_timestamp = optional; + using optional_uint64 = optional; + + #pragma db map type(optional_timestamp) as(brep::optional_uint64) \ + to((?) \ + ? std::chrono::duration_cast ( \ + (?)->time_since_epoch ()).count () \ + : brep::optional_uint64 ()) \ + from((?) \ + ? brep::timestamp ( \ + std::chrono::duration_cast ( \ + std::chrono::nanoseconds (*(?)))) \ + : brep::optional_timestamp ()) + // version // using bpkg::version; @@ -517,6 +531,22 @@ namespace brep #pragma db member(requirement_key::middle) column("alternative_index") #pragma db member(requirement_key::inner) column("index") + // Third-party service state which may optionally be associated with a + // tenant (see also mod/tenant-service.hxx for background). + // + #pragma db value + struct tenant_service + { + string id; + string type; + optional data; + + tenant_service () = default; + + tenant_service (string i, string t, optional d = nullopt) + : id (move (i)), type (move (t)), data (move (d)) {} + }; + // Version comparison operators. // // They allow comparing objects that have epoch, canonical_upstream, -- cgit v1.1