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