changeset 5203:6b7f3ec30ac4 db-protobuf

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 29 Mar 2023 12:04:13 +0200
parents 3a410992c626 (current diff) 4afb77166542 (diff)
children fb3add662286
files
diffstat 2 files changed, 78 insertions(+), 83 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Wed Mar 29 12:03:45 2023 +0200
+++ b/OrthancServer/Plugins/Include/orthanc/OrthancCPlugin.h	Wed Mar 29 12:04:13 2023 +0200
@@ -119,8 +119,8 @@
 #endif
 
 #define ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER     1
-#define ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER     11
-#define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER  3
+#define ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER     12
+#define ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER  0
 
 
 #if !defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)
@@ -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	Wed Mar 29 12:03:45 2023 +0200
+++ b/OrthancServer/Plugins/Include/orthanc/OrthancDatabasePlugin.proto	Wed Mar 29 12:04:13 2023 +0200
@@ -20,6 +20,15 @@
  **/
 
 
+/**
+ * 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";
 
 package Orthanc.DatabasePluginMessages;
@@ -91,19 +100,27 @@
  **/
 
 enum DatabaseOperation {
-  OPERATION_OPEN = 0;
-  OPERATION_CLOSE = 1;
-  OPERATION_FLUSH_TO_DISK = 2;
-  OPERATION_HAS_FLUSH_TO_DISK = 3;
+  OPERATION_GET_SYSTEM_INFORMATION = 0;
+  OPERATION_OPEN = 1;
+  OPERATION_CLOSE = 2;
+  OPERATION_FLUSH_TO_DISK = 3;
   OPERATION_START_TRANSACTION = 4;
-  OPERATION_GET_DATABASE_VERSION = 5;
-  OPERATION_UPGRADE = 6;
-  OPERATION_HAS_REVISION_SUPPORT = 7;
+  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 {
+    uint32 database_version = 1;
+    bool supports_flush_to_disk = 2;
+    bool supports_revisions = 3;
+  }
 }
 
 message Open {
@@ -127,14 +144,6 @@
   }
 }
 
-message TestFlushToDisk {
-  message Request {
-  }
-  message Response {
-    bool result = 1;
-  }
-}
-
 message StartTransaction {
   message Request {
     TransactionType type = 1;
@@ -144,58 +153,35 @@
   }
 }
 
-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 {
   }
 }
 
-message TestRevisionsSupport {
-  message Request {
-  }
-  message Response {
-    bool result = 1;
-  }
-}
 
-
-message RequestDatabase {
+message DatabaseRequest {
   sfixed64           database = 1;
   DatabaseOperation  operation = 2;
 
-  Open.Request                  open = 100;
-  Close.Request                 close = 101;
-  FlushToDisk.Request           flush_to_disk = 102;
-  TestFlushToDisk.Request       test_flush_to_disk = 103;
+  GetSystemInformation.Request  get_system_information = 100;
+  Open.Request                  open = 101;
+  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;
-  TestRevisionsSupport.Request  test_revisions_support = 107;
+  Upgrade.Request               upgrade = 105;
 }
 
-message ResponseDatabase {
-  int32   error_code = 1;
-  string  error_description = 2;
-
-  Open.Response                  open = 100;
-  Close.Response                 close = 101;
-  FlushToDisk.Response           flush_to_disk = 102;
-  TestFlushToDisk.Response       test_flush_to_disk = 103;
+message DatabaseResponse {
+  GetSystemInformation.Response  get_system_information = 100;
+  Open.Response                  open = 101;
+  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;
-  TestRevisionsSupport.Response  test_revisions_support = 107;
+  Upgrade.Response               upgrade = 105;
 }
 
 
@@ -214,7 +200,7 @@
   OPERATION_DELETE_RESOURCE = 7;
   OPERATION_GET_ALL_METADATA = 8;
   OPERATION_GET_ALL_PUBLIC_IDS = 9;
-  OPERATION_GET_ALL_PUBLIC_IDS_LIMITS = 10;
+  OPERATION_GET_ALL_PUBLIC_IDS_WITH_LIMITS = 10;
   OPERATION_GET_CHANGES = 11;
   OPERATION_GET_CHILDREN_INTERNAL_ID = 12;
   OPERATION_GET_CHILDREN_PUBLIC_ID = 13;
@@ -340,7 +326,7 @@
 
 message GetAllPublicIds {
   message Request {
-    int32 resource_type = 1;
+    ResourceType resource_type = 1;
   }
   message Response {
     repeated string ids = 1;
@@ -349,7 +335,7 @@
 
 message GetAllPublicIdsWithLimits {
   message Request {
-    int32  resource_type = 1;
+    ResourceType resource_type = 1;
     uint64 since = 2;
     uint32 limit = 3;
   }
@@ -360,7 +346,7 @@
 
 message GetChanges {
   message Request {
-    uint64 since = 1;
+    int64 since = 1;
     uint32 limit = 2;
   }
   message Response {
@@ -402,7 +388,7 @@
   message Request {
   }
   message Response {
-    bool is_empty = 1;
+    bool found = 1;
     ServerIndexChange change = 2;
   }
 }
@@ -411,7 +397,7 @@
   message Request {
   }
   message Response {
-    bool is_empty = 1;
+    bool found = 1;
     ExportedResource resource = 2;
   }
 }
@@ -477,7 +463,7 @@
     int64 patient_id = 1;
   }
   message Response {
-    bool protected = 1;
+    bool protected_patient = 1;
   }
 }
 
@@ -492,8 +478,10 @@
 
 message LogChange {
   message Request {
-    int64 id = 1;
-    ServerIndexChange change = 2;
+    int32         change_type = 1;
+    int64         resource_id = 2;
+    ResourceType  resource_type = 3;
+    string        date = 4;
   }
   message Response {
   }
@@ -501,7 +489,14 @@
 
 message LogExportedResource {
   message Request {
-    ExportedResource resource = 1;
+    ResourceType  resource_type = 1;
+    string        public_id = 2;
+    string        modality = 3;
+    string        date = 4;
+    string        patient_id = 5;
+    string        study_instance_uid = 6;
+    string        series_instance_uid = 7;
+    string        sop_instance_uid = 8;
   }
   message Response {
   }
@@ -521,8 +516,8 @@
 
 message LookupGlobalProperty {
   message Request {
-    int32 property = 1;
-    bool shared = 2;
+    string server_id = 1;
+    int32 property = 2;
   }
   message Response {
     bool found = 1;
@@ -568,7 +563,7 @@
   }
   message Response {
     bool found = 1;
-    int64 id = 2;
+    int64 patient_id = 2;
   }
 }
 
@@ -578,14 +573,14 @@
   }
   message Response {
     bool found = 1;
-    int64 id = 2;
+    int64 patient_id = 2;
   }
 }
 
 message SetGlobalProperty {
   message Request {
-    int32 property = 1;
-    bool shared = 2;
+    string server_id = 1;
+    int32 property = 2;
     string value = 3;
   }
   message Response {
@@ -613,8 +608,8 @@
 
 message SetProtectedPatient {
   message Request {
-    int64 id = 1;
-    bool protected = 2;
+    int64 patient_id = 1;
+    bool protected_patient = 2;
   }
   message Response {
   }
@@ -716,7 +711,7 @@
   }
 }
 
-message RequestTransaction {
+message TransactionRequest {
   sfixed64              transaction = 1;
   TransactionOperation  operation = 2;
 
@@ -767,10 +762,7 @@
   LookupResourceAndParent.Request         lookup_resource_and_parent = 144;
 }
 
-message ResponseTransaction {
-  int32   error_code = 1;
-  string  error_description = 2;
-
+message TransactionResponse {
   Rollback.Response                        rollback = 100;
   Commit.Response                          commit = 101;
   AddAttachment.Response                   add_attachment = 102;
@@ -825,11 +817,11 @@
 
 message Request {
   RequestType         type = 1;
-  RequestDatabase     request_database = 2;
-  RequestTransaction  request_transaction = 3;
+  DatabaseRequest     database_request = 2;
+  TransactionRequest  transaction_request = 3;
 }
 
 message Response {
-  ResponseDatabase     response_database = 1;
-  ResponseTransaction  response_transaction = 2;
+  DatabaseResponse     database_response = 2;
+  TransactionResponse  transaction_response = 3;
 }