changeset 5197:d8469ad83f39 db-protobuf

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 28 Mar 2023 18:10:29 +0200
parents 031ab885e18a
children d79e58c37705
files OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h OrthancServer/Plugins/Include/orthanc/OrthancDatabasePlugin.proto
diffstat 2 files changed, 16 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Tue Mar 28 12:43:38 2023 +0200
+++ b/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Tue Mar 28 18:10:29 2023 +0200
@@ -9184,6 +9184,7 @@
   typedef struct
   {
     void*                                   backend;
+    uint32_t                                maxDatabaseRetries;
     OrthancPluginCallDatabaseBackendV4      operations;
     OrthancPluginFinalizeDatabaseBackendV4  finalize;
   } _OrthancPluginRegisterDatabaseBackendV4;
@@ -9201,11 +9202,13 @@
   ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginRegisterDatabaseBackendV4(
     OrthancPluginContext*                   context,
     void*                                   backend,
+    uint32_t                                maxDatabaseRetries,  /* To handle "OrthancPluginErrorCode_DatabaseCannotSerialize" */
     OrthancPluginCallDatabaseBackendV4      operations,
     OrthancPluginFinalizeDatabaseBackendV4  finalize)
   {
     _OrthancPluginRegisterDatabaseBackendV4 params;
     params.backend = backend;
+    params.maxDatabaseRetries = maxDatabaseRetries;
     params.operations = operations;
     params.finalize = finalize;
 
--- a/OrthancServer/Plugins/Include/orthanc/OrthancDatabasePlugin.proto	Tue Mar 28 12:43:38 2023 +0200
+++ b/OrthancServer/Plugins/Include/orthanc/OrthancDatabasePlugin.proto	Tue Mar 28 18:10:29 2023 +0200
@@ -24,6 +24,9 @@
  * This Protocol Buffers prototype describes the exchanges between the
  * Orthanc core and its database plugins. The various calls correspond
  * to the "IDatabaseWrapper" interface in the source code of Orthanc.
+ *
+ * WARNING: *NEVER* modify or remove existing entries. It is only
+ * allowed to *add* new stuff.
  **/
 
 syntax = "proto3";
@@ -102,21 +105,21 @@
   OPERATION_CLOSE = 2;
   OPERATION_FLUSH_TO_DISK = 3;
   OPERATION_START_TRANSACTION = 4;
-  OPERATION_GET_DATABASE_VERSION = 5;
-  OPERATION_UPGRADE = 6;
+  OPERATION_UPGRADE = 5;
 }
 
 enum TransactionType {
-  TRANSACTION_TYPE_READ_ONLY = 0;
-  TRANSACTION_TYPE_READ_WRITE = 1;
+  TRANSACTION_READ_ONLY = 0;
+  TRANSACTION_READ_WRITE = 1;
 }
 
 message GetSystemInformation {
   message Request {
   }
   message Response {
-    bool supports_flush_to_disk = 1;
-    bool supports_revisions = 2;
+    uint32 database_version = 1;
+    bool supports_flush_to_disk = 2;
+    bool supports_revisions = 3;
   }
 }
 
@@ -150,18 +153,10 @@
   }
 }
 
-message GetDatabaseVersion {
-  message Request {
-  }
-  message Response {
-    uint32 version = 1;
-  }
-}
-
 message Upgrade {
   message Request {
-    uint32 targetVersion = 1;
-    sfixed64 storageArea = 2;
+    uint32 target_version = 1;
+    sfixed64 storage_area = 2;
   }
   message Response {
   }
@@ -177,8 +172,7 @@
   Close.Request                 close = 102;
   FlushToDisk.Request           flush_to_disk = 103;
   StartTransaction.Request      start_transaction = 104;
-  GetDatabaseVersion.Request    get_database_version = 105;
-  Upgrade.Request               upgrade = 106;
+  Upgrade.Request               upgrade = 105;
 }
 
 message DatabaseResponse {
@@ -187,8 +181,7 @@
   Close.Response                 close = 102;
   FlushToDisk.Response           flush_to_disk = 103;
   StartTransaction.Response      start_transaction = 104;
-  GetDatabaseVersion.Response    get_database_version = 105;
-  Upgrade.Response               upgrade = 106;
+  Upgrade.Response               upgrade = 105;
 }