Mercurial > hg > orthanc
annotate OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.h @ 4870:43e613a7756b
upgrade to year 2022
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 11 Jan 2022 11:15:42 +0100 |
parents | 7053502fbf97 |
children | 6eff25f70121 |
rev | line source |
---|---|
3636 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
3636 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
9 * modify it under the terms of the GNU General Public License as | |
10 * published by the Free Software Foundation, either version 3 of the | |
11 * License, or (at your option) any later version. | |
12 * | |
13 * In addition, as a special exception, the copyright holders of this | |
14 * program give permission to link the code of its release with the | |
15 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
16 * that use the same license as the "OpenSSL" library), and distribute | |
17 * the linked executables. You must obey the GNU General Public License | |
18 * in all respects for all of the code used other than "OpenSSL". If you | |
19 * modify file(s) with this exception, you may extend this exception to | |
20 * your version of the file(s), but you are not obligated to do so. If | |
21 * you do not wish to do so, delete this exception statement from your | |
22 * version. If you delete this exception statement from all source files | |
23 * in the program, then also delete it here. | |
24 * | |
25 * This program is distributed in the hope that it will be useful, but | |
26 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
28 * General Public License for more details. | |
29 * | |
30 * You should have received a copy of the GNU General Public License | |
31 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
32 **/ | |
33 | |
34 | |
35 #pragma once | |
36 | |
4045 | 37 #include "../../../OrthancFramework/Sources/Compatibility.h" |
38 #include "../../../OrthancFramework/Sources/DicomNetworking/RemoteModalityParameters.h" | |
39 #include "../../../OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.h" | |
3660
f159b731c47d
IStorageCommitmentFactory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3659
diff
changeset
|
40 #include "IStorageCommitmentFactory.h" |
3636 | 41 |
3660
f159b731c47d
IStorageCommitmentFactory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3659
diff
changeset
|
42 #include <memory> |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3642
diff
changeset
|
43 #include <vector> |
3636 | 44 |
45 namespace Orthanc | |
46 { | |
47 class ServerContext; | |
48 | |
49 class StorageCommitmentScpJob : public SetOfCommandsJob | |
50 { | |
51 private: | |
3659
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
52 enum CommandType |
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
53 { |
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
54 CommandType_Setup, |
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
55 CommandType_Lookup, |
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
56 CommandType_Answer |
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
57 }; |
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
58 |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3642
diff
changeset
|
59 class StorageCommitmentCommand; |
3659
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
60 class SetupCommand; |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3642
diff
changeset
|
61 class LookupCommand; |
3636 | 62 class AnswerCommand; |
63 class Unserializer; | |
64 | |
65 ServerContext& context_; | |
66 bool ready_; | |
67 std::string transactionUid_; | |
68 RemoteModalityParameters remoteModality_; | |
69 std::string calledAet_; | |
3661 | 70 std::vector<std::string> sopClassUids_; |
71 std::vector<std::string> sopInstanceUids_; | |
3636 | 72 |
3767 | 73 std::unique_ptr<IStorageCommitmentFactory::ILookupHandler> lookupHandler_; |
3660
f159b731c47d
IStorageCommitmentFactory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3659
diff
changeset
|
74 |
3661 | 75 void CheckInvariants(); |
76 | |
3660
f159b731c47d
IStorageCommitmentFactory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3659
diff
changeset
|
77 void Setup(const std::string& jobId); |
f159b731c47d
IStorageCommitmentFactory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3659
diff
changeset
|
78 |
3661 | 79 StorageCommitmentFailureReason Lookup(size_t index); |
3660
f159b731c47d
IStorageCommitmentFactory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3659
diff
changeset
|
80 |
3636 | 81 void Answer(); |
82 | |
83 public: | |
84 StorageCommitmentScpJob(ServerContext& context, | |
85 const std::string& transactionUid, | |
86 const std::string& remoteAet, | |
87 const std::string& calledAet); | |
88 | |
3638
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
89 StorageCommitmentScpJob(ServerContext& context, |
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
90 const Json::Value& serialized); |
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
91 |
3661 | 92 void Reserve(size_t size); |
93 | |
3636 | 94 void AddInstance(const std::string& sopClassUid, |
95 const std::string& sopInstanceUid); | |
96 | |
97 void MarkAsReady(); | |
98 | |
3638
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
99 virtual void Stop(JobStopReason reason) ORTHANC_OVERRIDE |
3636 | 100 { |
101 } | |
102 | |
3638
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
103 virtual void GetJobType(std::string& target) ORTHANC_OVERRIDE |
3636 | 104 { |
105 target = "StorageCommitmentScp"; | |
106 } | |
107 | |
3638
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
108 virtual void GetPublicContent(Json::Value& value) ORTHANC_OVERRIDE; |
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
109 |
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
110 virtual bool Serialize(Json::Value& target) ORTHANC_OVERRIDE; |
3636 | 111 }; |
112 } |