annotate OrthancServer/Resources/ImplementationNotes/DatabasesClassHierarchy.txt @ 5553:28cc06e4859a large-queries

Added ExtendedApiV1: /changes
author Alain Mazy <am@orthanc.team>
date Thu, 11 Apr 2024 19:02:20 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5553
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
1 The main object to access the DB is the ServerIndex class that is accessible from the ServerContext.
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
2
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
3 ServerIndex inherits from StatelessDatabaseOperations.
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
4
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
5 StatelessDatabaseOperations owns an IDatabaseWrapper member (db).
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
6 StatelessDatabaseOperations has 2 internal Transaction classes (ReadOnlyTransactions and ReadWriteTransactions) that implements the DB
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
7 operations by calling the methods from IDatabaseWrapper:ITransaction.
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
8
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
9 IDatabaseWrapper has 2 direct derived classes:
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
10 - BaseDatabaseWrapper which simply provides a "not implemented" implementation of new methods to its derived classes:
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
11 - OrthancPluginDatabase that is a legacy plugin interface
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
12 - OrthancPluginDatabaseV3 that is a legacy plugin interface
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
13 - SQLiteDatabaseWrapper that is used by the default SQLite DB in Orthanc
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
14 - OrthancPluginDatabaseV4 that is the latest plugin interface and uses protobuf
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
15
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
16 When you add a new method in the DB (e.g: UpdateAndGetStatistics with a new signature), you must:
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
17 - define it as a member of StatelessDatabaseOperations
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
18 - define it as a member of StatelessDatabaseOperations::ReadWriteTransactions or StatelessDatabaseOperations::ReadOnlyTransactions
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
19 - define it as a member of IDatabaseWrapper:ITransaction
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
20 - define it in OrthancDatabasePlugin.proto (new request + new response + new message)
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
21 - define it in OrthancPluginDatabaseV4
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
22 - define a NotImplemented default implementation in BaseDatabaseWrapper
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
23 - optionally define it in SQLiteDatabaseWrapper if it can be implemented in SQLite
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
24 - very likely define it as a DbCapabilities in IDatabaseWrapper::DbCapabilities (e.g: Has/SetUpdateAndGetStatistics()) such that the Orthanc
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
25 core knows if it can use it or not.
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
26
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
27 Then, in the orthanc-databases repo, you should:
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
28 - define it as a virtual member of IDatabaseBackend
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
29 - define it as a member of IndexBackend
28cc06e4859a Added ExtendedApiV1: /changes
Alain Mazy <am@orthanc.team>
parents:
diff changeset
30 - add a handler for the new protobuf message in DatabaseBackendAdapterV4