Mercurial > hg > orthanc
annotate OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.h @ 5340:0854cc13b4d5
better error reporting if anonymizing a study whose files are missings
author | Alain Mazy <am@osimis.io> |
---|---|
date | Wed, 28 Jun 2023 11:11:34 +0200 |
parents | 0ea402b4d901 |
children | 48b8dae6dc77 |
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 | |
5185
0ea402b4d901
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4892
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
0ea402b4d901
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4892
diff
changeset
|
6 * Copyright (C) 2021-2023 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 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 **/ | |
21 | |
22 | |
23 #pragma once | |
24 | |
4045 | 25 #include "../../../OrthancFramework/Sources/Compatibility.h" |
26 #include "../../../OrthancFramework/Sources/DicomNetworking/RemoteModalityParameters.h" | |
27 #include "../../../OrthancFramework/Sources/JobsEngine/SetOfCommandsJob.h" | |
3660
f159b731c47d
IStorageCommitmentFactory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3659
diff
changeset
|
28 #include "IStorageCommitmentFactory.h" |
3636 | 29 |
3660
f159b731c47d
IStorageCommitmentFactory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3659
diff
changeset
|
30 #include <memory> |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3642
diff
changeset
|
31 #include <vector> |
3636 | 32 |
33 namespace Orthanc | |
34 { | |
35 class ServerContext; | |
36 | |
37 class StorageCommitmentScpJob : public SetOfCommandsJob | |
38 { | |
39 private: | |
3659
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
40 enum CommandType |
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
41 { |
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
42 CommandType_Setup, |
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
43 CommandType_Lookup, |
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
44 CommandType_Answer |
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
45 }; |
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
46 |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3642
diff
changeset
|
47 class StorageCommitmentCommand; |
3659
08eb0f93c491
setup step in StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3657
diff
changeset
|
48 class SetupCommand; |
3657
115f82775c46
handling of storage commitment failure reasons
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3642
diff
changeset
|
49 class LookupCommand; |
3636 | 50 class AnswerCommand; |
51 class Unserializer; | |
52 | |
53 ServerContext& context_; | |
54 bool ready_; | |
55 std::string transactionUid_; | |
56 RemoteModalityParameters remoteModality_; | |
57 std::string calledAet_; | |
3661 | 58 std::vector<std::string> sopClassUids_; |
59 std::vector<std::string> sopInstanceUids_; | |
3636 | 60 |
3767 | 61 std::unique_ptr<IStorageCommitmentFactory::ILookupHandler> lookupHandler_; |
3660
f159b731c47d
IStorageCommitmentFactory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3659
diff
changeset
|
62 |
3661 | 63 void CheckInvariants(); |
64 | |
3660
f159b731c47d
IStorageCommitmentFactory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3659
diff
changeset
|
65 void Setup(const std::string& jobId); |
f159b731c47d
IStorageCommitmentFactory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3659
diff
changeset
|
66 |
3661 | 67 StorageCommitmentFailureReason Lookup(size_t index); |
3660
f159b731c47d
IStorageCommitmentFactory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3659
diff
changeset
|
68 |
3636 | 69 void Answer(); |
70 | |
71 public: | |
72 StorageCommitmentScpJob(ServerContext& context, | |
73 const std::string& transactionUid, | |
74 const std::string& remoteAet, | |
75 const std::string& calledAet); | |
76 | |
3638
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
77 StorageCommitmentScpJob(ServerContext& context, |
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
78 const Json::Value& serialized); |
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
79 |
3661 | 80 void Reserve(size_t size); |
81 | |
3636 | 82 void AddInstance(const std::string& sopClassUid, |
83 const std::string& sopInstanceUid); | |
84 | |
85 void MarkAsReady(); | |
86 | |
3638
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
87 virtual void Stop(JobStopReason reason) ORTHANC_OVERRIDE |
3636 | 88 { |
89 } | |
90 | |
3638
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
91 virtual void GetJobType(std::string& target) ORTHANC_OVERRIDE |
3636 | 92 { |
93 target = "StorageCommitmentScp"; | |
94 } | |
95 | |
3638
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
96 virtual void GetPublicContent(Json::Value& value) ORTHANC_OVERRIDE; |
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
97 |
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3636
diff
changeset
|
98 virtual bool Serialize(Json::Value& target) ORTHANC_OVERRIDE; |
3636 | 99 }; |
100 } |