annotate Sphinx/source/faq/transfer-atomicity.rst @ 822:0f4f11636193

transfers atomicity
author Alain Mazy <am@osimis.io>
date Mon, 21 Mar 2022 12:54:40 +0100
parents
children 9e953bba1b21
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
822
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
1 .. _dcmtk-tricks:
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
2
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
3 How to guarantee study transfer atomicity ?
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
4 =========================================
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
5
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
6 .. contents::
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
7 :depth: 3
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
8
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
9 Introduction
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
10 ------------
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
11
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
12 There are multiple ways to transfer studies to an Orthanc instance.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
13 Only a few of them provide a guarantee that the study has been
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
14 transferred completely.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
15
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
16 **Notes**:
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
17
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
18 * By ``transfer atomicity``, we mean the capability to transfer
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
19 only full studies and make sure that if a transfer fails before
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
20 it is complete, no partial data is saved in Orthanc. The study is either
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
21 fully stored or not stored at all.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
22
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
23 * DICOM, in general, does not provide any way to detect that a study
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
24 is ``complete``. Actually, a study is never ``complete`` since, e.g,
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
25 a viewing workstation or an AI algorithm can still add a new enhanced
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
26 series even years after the study has been acquired.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
27 However, it is still important, in many applications, to make sure
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
28 that a study, in its current state, is fully transmitted to another
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
29 destination.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
30
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
31 * Both the **client/source** and the **server/destination** might be interrested
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
32 in the transfer status. Usually, the **client** will have a guarantee that the
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
33 study was fully transmitted if it receives a successful answer from the server.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
34 On the **server** side, it is usually more complex to make sure that the
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
35 full study has been received.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
36
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
37
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
38 Summary
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
39 -------
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
40
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
41 +--------------------------------------------------+--------------------------------------------------+-----------------------------------------------+
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
42 | Transfer method | What can the Client/source trust to make sure | Can Server/destination trust ``StableStudy`` |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
43 | | the full study has been stored in the server ? | event to consider the study as complete ? |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
44 +==================================================+==================================================+===============================================+
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
45 | **C-Store** | * If every C-Store receives a success status. | No |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
46 | | * If ``/modalities/sample/store`` receives a | |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
47 | | 200 or if job is successfull | |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
48 +--------------------------------------------------+--------------------------------------------------+-----------------------------------------------+
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
49 | **C-Store with storage commitment** | * same as above | No |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
50 | | * use storage commitment to check which | |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
51 | | instances are stored on destination | |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
52 +--------------------------------------------------+--------------------------------------------------+-----------------------------------------------+
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
53 | **DicomWeb** | * If client receives a 200 | No |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
54 | | * If ``/dicom-web/servers/sample/stow`` returns | |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
55 | | a 200 or if job is successfull | |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
56 +--------------------------------------------------+--------------------------------------------------+-----------------------------------------------+
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
57 | **Orthanc Rest API** | * If every call to ``/instances`` receives a | No |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
58 | | 200 | |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
59 | | * If ``/peers/sample/store`` receives a | |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
60 | | 200 or if job is successfull | |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
61 +--------------------------------------------------+--------------------------------------------------+-----------------------------------------------+
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
62 | **Transfers accelerator plugin** | * If ``/transfers/send`` receives a | Yes (provided that the client sends full |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
63 | | 200 or if job is successfull | study) |
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
64 +--------------------------------------------------+--------------------------------------------------+-----------------------------------------------+
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
65
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
66
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
67 C-Store
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
68 -------
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
69
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
70 If you are sending a study to Orthanc via C-Store, the study will be
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
71 considered as ``stable`` after a given period of time (defined by
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
72 the configuration ``StableAge``). This gives no guarantee at all that
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
73 the study has been fully transferred. The sending modality may have
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
74 paused transfer for a while and might resume in a few minutes.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
75
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
76 Although inaccurate by design, the ``IsStable`` status in Orthanc is the
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
77 best way to assume that a study has been fully transferred via DICOM.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
78 The default value of ``60 seconds`` is appropriate for most setups.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
79
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
80 **Note**:
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
81
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
82 * When Orthanc, acting as C-Store SCP, responds with a success status to a C-Store command,
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
83 it means that the instance has already been saved in the DB and
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
84 on the storage.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
85
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
86
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
87
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
88 C-Store with storage commitment
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
89 -------------------------------
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
90
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
91 Since release 1.6.0, Orthanc supports :ref:`Storage Commitment <storage-commitment>`.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
92 Storage commitment is not a guarantee of atomicity but simply provides a
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
93 way to check that a set of instances have really been saved by Orthanc.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
94
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
95 Given that Orthanc only responsds to C-Store with a success status once the
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
96 instance has really been saved in DB and on disk, storage commitment
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
97 actually do not provide any additional guarantee during transfer.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
98
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
99
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
100 DicomWeb STOW-RS
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
101 ----------------
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
102
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
103 :ref:`STOW-RS <dicomweb-stow-rs>` can be used to transfer studies to an Orthanc.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
104 The STOW-RS request contains a list of DICOM instances to store in the destination
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
105 Orthanc (likely a complete study).
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
106
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
107 Files are stored as they are received which means that, if the transfer is interrupted,
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
108 only a partial study may be stored on the destination. Therefore, on the destination,
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
109 a ``StableStudy`` event might be triggered even if the study was not fully received.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
110
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
111
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
112 **Note**:
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
113
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
114 * In earlier Orthanc versions, ``ChunkedTransfers`` was disabled, and the whole study
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
115 was transmitted in a single HTTP request and parsed only once the full HTTP request
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
116 had been received. Therefore, the whole study was stored at once on the destination.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
117 However, note that ``ChunkedTransfers`` is enabled by default on every Orthanc server
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
118 but it can be disabled in the client configuration. Also note that studies bigger than
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
119 2 GB can not be transferred with ``ChunkedTransfers`` disabled which means it is not
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
120 recommended to perform transfers with disabled ``ChunkedTransfers``.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
121
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
122
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
123
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
124 Orthanc Rest API
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
125 ----------------
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
126
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
127 When transferring a study through the Orthanc Rest API, each instance is transferred individually.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
128 Therefore, on server side, if the transfer is interrupted, the destination has no way to know that the study
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
129 has been fully transmitted or not.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
130
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
131 The server will respond with a 200 HTTP status only once the instance is stored in DB and on storage.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
132
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
133
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
134
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
135 Transfers Accelerator plugin
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
136 ----------------------------
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
137
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
138 :ref:`Transfers Accelerator plugin <transfers>` has been design to:
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
139
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
140 * speed up transfers over HTTP/HTTPS.
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
141 * guarantee the transfer atomicity
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
142
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
143 Provided that the client is sending a full study, the server receiving it
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
144 will store it completely. Therefore, on server side, the ``StableStudy`` event will trigger only
0f4f11636193 transfers atomicity
Alain Mazy <am@osimis.io>
parents:
diff changeset
145 on full studies.