annotate OrthancServer/Plugins/Samples/DelayedDeletion/LargeDeleteJob.cpp @ 5153:217863b09457 malloc-trim

malloc_trim doc
author Alain Mazy <am@osimis.io>
date Wed, 01 Feb 2023 19:23:58 +0100
parents c2ebc47f4f18
children 99751c5a7cfe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5024
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
1 #include "LargeDeleteJob.h"
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
2
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
3 #include "../../../../OrthancFramework/Sources/Logging.h"
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
4 #include "../../../../OrthancFramework/Sources/OrthancException.h"
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
5
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
6 #include <json/reader.h>
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
7
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
8 void LargeDeleteJob::UpdateDeleteProgress()
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
9 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
10 size_t total = 2 * resources_.size() + instances_.size() + series_.size();
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
11
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
12 float progress;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
13 if (total == 0)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
14 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
15 progress = 1;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
16 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
17 else
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
18 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
19 progress = (static_cast<float>(posResources_ + posInstances_ + posSeries_ + posDelete_) /
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
20 static_cast<float>(total));
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
21 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
22
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
23 UpdateProgress(progress);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
24 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
25
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
26
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
27 void LargeDeleteJob::ScheduleChildrenResources(std::vector<std::string>& target,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
28 const std::string& uri)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
29 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
30 Json::Value items;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
31 if (OrthancPlugins::RestApiGet(items, uri, false))
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
32 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
33 if (items.type() != Json::arrayValue)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
34 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
35 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
36 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
37
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
38 for (Json::Value::ArrayIndex i = 0; i < items.size(); i++)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
39 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
40 if (items[i].type() != Json::objectValue ||
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
41 !items[i].isMember("ID") ||
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
42 items[i]["ID"].type() != Json::stringValue)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
43 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
44 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
45 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
46 else
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
47 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
48 target.push_back(items[i]["ID"].asString());
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
49 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
50 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
51 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
52 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
53
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
54
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
55 void LargeDeleteJob::ScheduleResource(Orthanc::ResourceType level,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
56 const std::string& id)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
57 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
58 #if 0
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
59 // Instance-level granularity => very slow!
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
60 switch (level)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
61 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
62 case Orthanc::ResourceType_Patient:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
63 ScheduleChildrenResources(instances_, "/patients/" + id + "/instances");
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
64 break;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
65
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
66 case Orthanc::ResourceType_Study:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
67 ScheduleChildrenResources(instances_, "/studies/" + id + "/instances");
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
68 break;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
69
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
70 case Orthanc::ResourceType_Series:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
71 ScheduleChildrenResources(instances_, "/series/" + id + "/instances");
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
72 break;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
73
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
74 case Orthanc::ResourceType_Instance:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
75 instances_.push_back(id);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
76 break;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
77
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
78 default:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
79 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
80 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
81 #else
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
82 /**
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
83 * Series-level granularity => looks like a good compromise between
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
84 * having the Orthanc mutex locked during all the study, and very
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
85 * slow instance-level granularity.
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
86 **/
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
87 switch (level)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
88 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
89 case Orthanc::ResourceType_Patient:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
90 ScheduleChildrenResources(series_, "/patients/" + id + "/series");
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
91 break;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
92
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
93 case Orthanc::ResourceType_Study:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
94 ScheduleChildrenResources(series_, "/studies/" + id + "/series");
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
95 break;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
96
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
97 case Orthanc::ResourceType_Series:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
98 series_.push_back(id);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
99 break;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
100
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
101 case Orthanc::ResourceType_Instance:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
102 instances_.push_back(id);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
103 break;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
104
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
105 default:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
106 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
107 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
108 #endif
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
109 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
110
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
111
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
112 void LargeDeleteJob::DeleteResource(Orthanc::ResourceType level,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
113 const std::string& id)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
114 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
115 std::string uri;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
116 switch (level)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
117 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
118 case Orthanc::ResourceType_Patient:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
119 uri = "/patients/" + id;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
120 break;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
121
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
122 case Orthanc::ResourceType_Study:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
123 uri = "/studies/" + id;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
124 break;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
125
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
126 case Orthanc::ResourceType_Series:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
127 uri = "/series/" + id;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
128 break;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
129
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
130 case Orthanc::ResourceType_Instance:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
131 uri = "/instances/" + id;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
132 break;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
133
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
134 default:
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
135 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
136 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
137
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
138 OrthancPlugins::RestApiDelete(uri, false);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
139 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
140
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
141
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
142 LargeDeleteJob::LargeDeleteJob(const std::vector<std::string>& resources,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
143 const std::vector<Orthanc::ResourceType>& levels) :
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
144 OrthancJob("LargeDelete"),
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
145 resources_(resources),
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
146 levels_(levels),
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
147 posResources_(0),
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
148 posInstances_(0),
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
149 posDelete_(0)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
150 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
151 if (resources.size() != levels.size())
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
152 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
153 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
154 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
155 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
156
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
157
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
158 OrthancPluginJobStepStatus LargeDeleteJob::Step()
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
159 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
160 if (posResources_ == 0)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
161 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
162 if (resources_.size() == 1)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
163 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
164 // LOG(WARNING) << "LargeDeleteJob has started on resource: " << resources_[0];
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
165 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
166 else
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
167 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
168 // LOG(WARNING) << "LargeDeleteJob has started";
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
169 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
170 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
171
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
172 if (posResources_ < resources_.size())
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
173 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
174 // First step: Discovering all the instances of the resources
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
175
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
176 ScheduleResource(levels_[posResources_], resources_[posResources_]);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
177
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
178 posResources_ += 1;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
179 UpdateDeleteProgress();
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
180 return OrthancPluginJobStepStatus_Continue;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
181 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
182 else if (posInstances_ < instances_.size())
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
183 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
184 // Second step: Deleting the instances one by one
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
185
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
186 DeleteResource(Orthanc::ResourceType_Instance, instances_[posInstances_]);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
187
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
188 posInstances_ += 1;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
189 UpdateDeleteProgress();
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
190 return OrthancPluginJobStepStatus_Continue;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
191 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
192 else if (posSeries_ < series_.size())
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
193 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
194 // Third step: Deleting the series one by one
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
195
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
196 DeleteResource(Orthanc::ResourceType_Series, series_[posSeries_]);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
197
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
198 posSeries_ += 1;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
199 UpdateDeleteProgress();
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
200 return OrthancPluginJobStepStatus_Continue;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
201 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
202 else if (posDelete_ < resources_.size())
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
203 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
204 // Fourth step: Make sure the resources where fully deleted
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
205 // (instances might have been received since the beginning of
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
206 // the job)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
207
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
208 DeleteResource(levels_[posDelete_], resources_[posDelete_]);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
209
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
210 posDelete_ += 1;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
211 UpdateDeleteProgress();
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
212 return OrthancPluginJobStepStatus_Continue;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
213 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
214 else
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
215 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
216 if (resources_.size() == 1)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
217 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
218 // LOG(WARNING) << "LargeDeleteJob has completed on resource: " << resources_[0];
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
219 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
220 else
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
221 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
222 // LOG(WARNING) << "LargeDeleteJob has completed";
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
223 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
224
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
225 UpdateProgress(1);
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
226 return OrthancPluginJobStepStatus_Success;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
227 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
228 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
229
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
230
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
231 void LargeDeleteJob::Reset()
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
232 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
233 posResources_ = 0;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
234 posInstances_ = 0;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
235 posDelete_ = 0;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
236 instances_.clear();
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
237 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
238
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
239
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
240 void LargeDeleteJob::RestHandler(OrthancPluginRestOutput* output,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
241 const char* url,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
242 const OrthancPluginHttpRequest* request)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
243 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
244 static const char* KEY_RESOURCES = "Resources";
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
245
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
246 if (request->method != OrthancPluginHttpMethod_Post)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
247 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
248 OrthancPluginSendMethodNotAllowed(OrthancPlugins::GetGlobalContext(), output, "POST");
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
249 return;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
250 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
251
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
252 Json::Value body;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
253 Json::Reader reader;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
254 if (!reader.parse(reinterpret_cast<const char*>(request->body),
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
255 reinterpret_cast<const char*>(request->body) + request->bodySize, body))
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
256 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
257 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "JSON body is expected");
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
258 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
259
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
260 if (body.type() != Json::objectValue)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
261 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
262 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
263 "Expected a JSON object in the body");
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
264 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
265
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
266 if (!body.isMember(KEY_RESOURCES) ||
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
267 body[KEY_RESOURCES].type() != Json::arrayValue)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
268 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
269 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
270 "The JSON object must contain an array in \"" +
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
271 std::string(KEY_RESOURCES) + "\"");
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
272 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
273
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
274 std::vector<std::string> resources;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
275 std::vector<Orthanc::ResourceType> levels;
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
276
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
277 resources.reserve(body.size());
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
278 levels.reserve(body.size());
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
279
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
280 const Json::Value& arr = body[KEY_RESOURCES];
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
281 for (Json::Value::ArrayIndex i = 0; i < arr.size(); i++)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
282 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
283 if (arr[i].type() != Json::arrayValue ||
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
284 arr[i].size() != 2u ||
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
285 arr[i][0].type() != Json::stringValue ||
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
286 arr[i][1].type() != Json::stringValue)
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
287 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
288 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
289 "Each entry must be an array containing 2 strings, "
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
290 "the resource level and its ID");
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
291 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
292 else
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
293 {
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
294 levels.push_back(Orthanc::StringToResourceType(arr[i][0].asCString()));
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
295 resources.push_back(arr[i][1].asString());
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
296 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
297 }
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
298
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
299 OrthancPlugins::OrthancJob::SubmitFromRestApiPost(
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
300 output, body, new LargeDeleteJob(resources, levels));
c2ebc47f4f18 wip: adding DelayedDeletion plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
301 }