annotate OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp @ 5583:74cc31c8db2b find-refactoring

removed FindResponse::Item::responseContent_
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 27 Apr 2024 22:15:37 +0200
parents 3a6d6d35193c
children 0e16e677fe64
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
1 /**
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5452
diff changeset
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5452
diff changeset
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
7 *
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
9 * modify it under the terms of the GNU General Public License as
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
10 * published by the Free Software Foundation, either version 3 of the
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
11 * License, or (at your option) any later version.
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
12 *
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
16 * General Public License for more details.
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
17 *
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
20 **/
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
21
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
22
5538
6ce05f8b5b13 deprecating OrthancPluginSetDescription2(), OrthancPluginExtendOrthancExplorer2() and OrthancPluginSetRootUri2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
23 #define HOUSEKEEPER_NAME "housekeeper"
6ce05f8b5b13 deprecating OrthancPluginSetDescription2(), OrthancPluginExtendOrthancExplorer2() and OrthancPluginSetRootUri2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
24
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
25 #include "../Common/OrthancPluginCppWrapper.h"
5576
3a6d6d35193c fix build of Housekeeper plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5573
diff changeset
26 #include "../../../../OrthancFramework/Sources/Compatibility.h"
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
27
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
28 #include <boost/thread.hpp>
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
29 #include <boost/algorithm/string.hpp>
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
30 #include <boost/date_time/posix_time/posix_time.hpp>
4991
Alain Mazy <am@osimis.io>
parents: 4988
diff changeset
31 #include <boost/date_time/special_defs.hpp>
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
32 #include <json/value.h>
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
33 #include <json/writer.h>
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
34 #include <string.h>
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
35 #include <iostream>
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
36 #include <algorithm>
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
37 #include <map>
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
38 #include <list>
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
39 #include <time.h>
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
40
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
41 static int globalPropertyId_ = 0;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
42 static bool force_ = false;
4982
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
43 static unsigned int throttleDelay_ = 0;
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
44 static std::unique_ptr<boost::thread> workerThread_;
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
45 static bool workerThreadShouldStop_ = false;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
46 static bool triggerOnStorageCompressionChange_ = true;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
47 static bool triggerOnMainDicomTagsChange_ = true;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
48 static bool triggerOnUnnecessaryDicomAsJsonFiles_ = true;
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
49 static bool triggerOnIngestTranscodingChange_ = true;
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
50 static bool triggerOnDicomWebCacheChange_ = true;
5558
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
51 static std::string limitMainDicomTagsReconstructLevel_ = "";
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
52 static std::string limitToChange_ = "";
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
53 static std::string limitToUrl_ = "";
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
54
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
55
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
56 struct RunningPeriod
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
57 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
58 int fromHour_;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
59 int toHour_;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
60 int weekday_;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
61
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
62 RunningPeriod(const std::string& weekday, const std::string& period)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
63 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
64 if (weekday == "Monday")
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
65 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
66 weekday_ = 1;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
67 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
68 else if (weekday == "Tuesday")
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
69 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
70 weekday_ = 2;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
71 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
72 else if (weekday == "Wednesday")
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
73 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
74 weekday_ = 3;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
75 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
76 else if (weekday == "Thursday")
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
77 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
78 weekday_ = 4;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
79 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
80 else if (weekday == "Friday")
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
81 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
82 weekday_ = 5;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
83 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
84 else if (weekday == "Saturday")
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
85 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
86 weekday_ = 6;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
87 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
88 else if (weekday == "Sunday")
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
89 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
90 weekday_ = 0;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
91 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
92 else
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
93 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
94 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: invalid schedule: unknown 'day': " + weekday);
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
95 ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
96 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
97
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
98 std::vector<std::string> hours;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
99 boost::split(hours, period, boost::is_any_of("-"));
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
100
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
101 fromHour_ = boost::lexical_cast<int>(hours[0]);
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
102 toHour_ = boost::lexical_cast<int>(hours[1]);
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
103 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
104
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
105 bool isInPeriod() const
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
106 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
107 time_t now = time(NULL);
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
108 tm* nowLocalTime = localtime(&now);
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
109
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
110 if (nowLocalTime->tm_wday != weekday_)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
111 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
112 return false;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
113 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
114
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
115 if (nowLocalTime->tm_hour >= fromHour_ && nowLocalTime->tm_hour < toHour_)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
116 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
117 return true;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
118 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
119
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
120 return false;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
121 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
122 };
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
123
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
124
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
125 struct RunningPeriods
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
126 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
127 std::list<RunningPeriod> runningPeriods_;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
128
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
129 void load(const Json::Value& scheduleConfiguration)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
130 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
131 // "Monday": ["0-6", "20-24"],
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
132
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
133 Json::Value::Members names = scheduleConfiguration.getMemberNames();
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
134
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
135 for (Json::Value::Members::const_iterator it = names.begin();
5280
49477780e25a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5223
diff changeset
136 it != names.end(); ++it)
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
137 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
138 for (Json::Value::ArrayIndex i = 0; i < scheduleConfiguration[*it].size(); i++)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
139 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
140 runningPeriods_.push_back(RunningPeriod(*it, scheduleConfiguration[*it][i].asString()));
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
141 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
142 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
143 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
144
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
145 bool isInPeriod()
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
146 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
147 if (runningPeriods_.size() == 0)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
148 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
149 return true; // if no config: always run
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
150 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
151
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
152 for (std::list<RunningPeriod>::const_iterator it = runningPeriods_.begin();
5280
49477780e25a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5223
diff changeset
153 it != runningPeriods_.end(); ++it)
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
154 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
155 if (it->isInPeriod())
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
156 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
157 return true;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
158 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
159 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
160 return false;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
161 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
162 };
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
163
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
164 RunningPeriods runningPeriods_;
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
165
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
166
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
167 struct DbConfiguration
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
168 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
169 std::string orthancVersion;
4982
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
170 std::string patientsMainDicomTagsSignature;
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
171 std::string studiesMainDicomTagsSignature;
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
172 std::string seriesMainDicomTagsSignature;
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
173 std::string instancesMainDicomTagsSignature;
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
174 std::string ingestTranscoding;
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
175 std::string dicomWebVersion;
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
176 bool storageCompressionEnabled;
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
177
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
178 DbConfiguration()
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
179 : storageCompressionEnabled(false)
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
180 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
181 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
182
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
183 bool IsDefined() const
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
184 {
4982
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
185 return !orthancVersion.empty();
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
186 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
187
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
188 void Clear()
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
189 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
190 orthancVersion.clear();
4982
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
191 patientsMainDicomTagsSignature.clear();
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
192 studiesMainDicomTagsSignature.clear();
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
193 seriesMainDicomTagsSignature.clear();
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
194 instancesMainDicomTagsSignature.clear();
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
195 ingestTranscoding.clear();
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
196 dicomWebVersion.clear();
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
197 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
198
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
199 void ToJson(Json::Value& target)
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
200 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
201 if (!IsDefined())
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
202 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
203 target = Json::nullValue;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
204 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
205 else
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
206 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
207 Json::Value signatures;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
208
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
209 target = Json::objectValue;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
210
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
211 // default main dicom tags signature are the one from Orthanc 1.4.2 (last time the list was changed):
4982
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
212 signatures["Patient"] = patientsMainDicomTagsSignature;
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
213 signatures["Study"] = studiesMainDicomTagsSignature;
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
214 signatures["Series"] = seriesMainDicomTagsSignature;
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
215 signatures["Instance"] = instancesMainDicomTagsSignature;
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
216
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
217 target["MainDicomTagsSignature"] = signatures;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
218 target["OrthancVersion"] = orthancVersion;
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
219 target["StorageCompressionEnabled"] = storageCompressionEnabled;
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
220 target["IngestTranscoding"] = ingestTranscoding;
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
221 target["DicomWebVersion"] = dicomWebVersion;
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
222 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
223 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
224
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
225 void FromJson(Json::Value& source)
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
226 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
227 if (!source.isNull())
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
228 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
229 orthancVersion = source["OrthancVersion"].asString();
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
230 if (source.isMember("DicomWebVersion"))
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
231 {
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
232 dicomWebVersion = source["DicomWebVersion"].asString();
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
233 }
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
234 else
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
235 {
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
236 dicomWebVersion = "1.14"; // the first change that requires processing has been introduced between 1.14 & 1.15
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
237 }
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
238
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
239 const Json::Value& signatures = source["MainDicomTagsSignature"];
4982
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
240 patientsMainDicomTagsSignature = signatures["Patient"].asString();
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
241 studiesMainDicomTagsSignature = signatures["Study"].asString();
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
242 seriesMainDicomTagsSignature = signatures["Series"].asString();
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
243 instancesMainDicomTagsSignature = signatures["Instance"].asString();
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
244
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
245 storageCompressionEnabled = source["StorageCompressionEnabled"].asBool();
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
246 ingestTranscoding = source["IngestTranscoding"].asString();
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
247 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
248 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
249 };
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
250
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
251
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
252 struct PluginStatus
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
253 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
254 int statusVersion;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
255 int64_t lastProcessedChange;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
256 int64_t lastChangeToProcess;
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
257 boost::posix_time::ptime lastTimeStarted;
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
258
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
259 DbConfiguration currentlyProcessingConfiguration; // last configuration being processed (has not reached last change yet)
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
260 DbConfiguration lastProcessedConfiguration; // last configuration that has been fully processed (till last change)
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
261
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
262 PluginStatus()
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
263 : statusVersion(1),
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
264 lastProcessedChange(-1),
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
265 lastChangeToProcess(-1),
4993
8feb00fea93d fix build
Alain Mazy <am@osimis.io>
parents: 4991
diff changeset
266 lastTimeStarted(boost::date_time::not_a_date_time)
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
267 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
268 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
269
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
270 void ToJson(Json::Value& target)
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
271 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
272 target = Json::objectValue;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
273
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
274 target["Version"] = statusVersion;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
275 target["LastProcessedChange"] = Json::Value::Int64(lastProcessedChange);
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
276 target["LastChangeToProcess"] = Json::Value::Int64(lastChangeToProcess);
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
277
4993
8feb00fea93d fix build
Alain Mazy <am@osimis.io>
parents: 4991
diff changeset
278 if (lastTimeStarted == boost::date_time::not_a_date_time)
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
279 {
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
280 target["LastTimeStarted"] = Json::Value::null;
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
281 }
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
282 else
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
283 {
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
284 target["LastTimeStarted"] = boost::posix_time::to_iso_string(lastTimeStarted);
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
285 }
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
286
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
287 currentlyProcessingConfiguration.ToJson(target["CurrentlyProcessingConfiguration"]);
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
288 lastProcessedConfiguration.ToJson(target["LastProcessedConfiguration"]);
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
289 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
290
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
291 void FromJson(Json::Value& source)
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
292 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
293 statusVersion = source["Version"].asInt();
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
294 lastProcessedChange = source["LastProcessedChange"].asInt64();
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
295 lastChangeToProcess = source["LastChangeToProcess"].asInt64();
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
296 if (source["LastTimeStarted"].isNull())
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
297 {
4993
8feb00fea93d fix build
Alain Mazy <am@osimis.io>
parents: 4991
diff changeset
298 lastTimeStarted = boost::date_time::not_a_date_time;
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
299 }
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
300 else
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
301 {
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
302 lastTimeStarted = boost::posix_time::from_iso_string(source["LastTimeStarted"].asString());
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
303 }
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
304
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
305 Json::Value& current = source["CurrentlyProcessingConfiguration"];
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
306 Json::Value& last = source["LastProcessedConfiguration"];
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
307
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
308 currentlyProcessingConfiguration.FromJson(current);
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
309 lastProcessedConfiguration.FromJson(last);
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
310 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
311 };
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
312
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
313 static PluginStatus pluginStatus_;
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
314 static boost::recursive_mutex pluginStatusMutex_;
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
315
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
316 static void ReadStatusFromDb()
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
317 {
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
318 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_);
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
319
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
320 OrthancPlugins::OrthancString globalPropertyContent;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
321
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
322 globalPropertyContent.Assign(OrthancPluginGetGlobalProperty(OrthancPlugins::GetGlobalContext(),
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
323 globalPropertyId_,
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
324 ""));
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
325
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
326 if (!globalPropertyContent.IsNullOrEmpty())
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
327 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
328 Json::Value jsonStatus;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
329 globalPropertyContent.ToJson(jsonStatus);
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
330 pluginStatus_.FromJson(jsonStatus);
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
331 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
332 else
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
333 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
334 // default config
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
335 pluginStatus_.statusVersion = 1;
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
336 pluginStatus_.lastProcessedChange = -1;
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
337 pluginStatus_.lastChangeToProcess = -1;
4993
8feb00fea93d fix build
Alain Mazy <am@osimis.io>
parents: 4991
diff changeset
338 pluginStatus_.lastTimeStarted = boost::date_time::not_a_date_time;
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
339
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
340 pluginStatus_.lastProcessedConfiguration.orthancVersion = "1.9.0"; // when we don't know, we assume some files were stored with Orthanc 1.9.0 (last version saving the dicom-as-json files)
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
341 pluginStatus_.lastProcessedConfiguration.dicomWebVersion = "1.14"; // the first change that requires processing has been introduced between 1.14 & 1.15
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
342
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
343 // default main dicom tags signature are the one from Orthanc 1.4.2 (last time the list was changed):
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
344 pluginStatus_.lastProcessedConfiguration.patientsMainDicomTagsSignature = "0010,0010;0010,0020;0010,0030;0010,0040;0010,1000";
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
345 pluginStatus_.lastProcessedConfiguration.studiesMainDicomTagsSignature = "0008,0020;0008,0030;0008,0050;0008,0080;0008,0090;0008,1030;0020,000d;0020,0010;0032,1032;0032,1060";
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
346 pluginStatus_.lastProcessedConfiguration.seriesMainDicomTagsSignature = "0008,0021;0008,0031;0008,0060;0008,0070;0008,1010;0008,103e;0008,1070;0018,0010;0018,0015;0018,0024;0018,1030;0018,1090;0018,1400;0020,000e;0020,0011;0020,0037;0020,0105;0020,1002;0040,0254;0054,0081;0054,0101;0054,1000";
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
347 pluginStatus_.lastProcessedConfiguration.instancesMainDicomTagsSignature = "0008,0012;0008,0013;0008,0018;0020,0012;0020,0013;0020,0032;0020,0037;0020,0100;0020,4000;0028,0008;0054,1330";
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
348 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
349 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
350
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
351 static void SaveStatusInDb()
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
352 {
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
353 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_);
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
354
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
355 Json::Value jsonStatus;
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
356 pluginStatus_.ToJson(jsonStatus);
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
357
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
358 Json::StreamWriterBuilder builder;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
359 builder.settings_["indentation"] = " ";
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
360 std::string serializedStatus = Json::writeString(builder, jsonStatus);
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
361
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
362 OrthancPluginSetGlobalProperty(OrthancPlugins::GetGlobalContext(),
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
363 globalPropertyId_,
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
364 serializedStatus.c_str());
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
365 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
366
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
367 static void GetCurrentDbConfiguration(DbConfiguration& configuration)
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
368 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
369 Json::Value signatures;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
370 Json::Value systemInfo;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
371
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
372 OrthancPlugins::RestApiGet(systemInfo, "/system", false);
4982
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
373 configuration.patientsMainDicomTagsSignature = systemInfo["MainDicomTags"]["Patient"].asString();
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
374 configuration.studiesMainDicomTagsSignature = systemInfo["MainDicomTags"]["Study"].asString();
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
375 configuration.seriesMainDicomTagsSignature = systemInfo["MainDicomTags"]["Series"].asString();
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
376 configuration.instancesMainDicomTagsSignature = systemInfo["MainDicomTags"]["Instance"].asString();
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
377 configuration.storageCompressionEnabled = systemInfo["StorageCompression"].asBool();
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
378 configuration.ingestTranscoding = systemInfo["IngestTranscoding"].asString();
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
379
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
380 configuration.orthancVersion = OrthancPlugins::GetGlobalContext()->orthancVersion;
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
381
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
382 Json::Value pluginInfo;
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
383 if (OrthancPlugins::RestApiGet(pluginInfo, "/plugins/dicom-web", false))
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
384 {
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
385 configuration.dicomWebVersion = pluginInfo["Version"].asString();
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
386 }
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
387 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
388
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
389 static void CheckNeedsProcessing(bool& needsReconstruct, bool& needsReingest, bool& needsDicomWebCaching, const DbConfiguration& current, const DbConfiguration& last)
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
390 {
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
391 needsReconstruct = false;
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
392 needsReingest = false;
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
393 needsDicomWebCaching = false;
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
394
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
395 if (!last.IsDefined())
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
396 {
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
397 return;
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
398 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
399
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
400 const char* lastVersion = last.orthancVersion.c_str();
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
401
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
402 if (!OrthancPlugins::CheckMinimalVersion(lastVersion, 1, 9, 1))
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
403 {
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
404 if (triggerOnUnnecessaryDicomAsJsonFiles_)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
405 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
406 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: your storage might still contain some dicom-as-json files -> will perform housekeeping");
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
407 needsReconstruct = true; // the default reconstruct removes the dicom-as-json
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
408 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
409 else
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
410 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
411 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: your storage might still contain some dicom-as-json files but the trigger has been disabled");
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
412 }
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
413 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
414
4982
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
415 if (last.patientsMainDicomTagsSignature != current.patientsMainDicomTagsSignature)
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
416 {
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
417 if (triggerOnMainDicomTagsChange_)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
418 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
419 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Patient main dicom tags have changed, -> will perform housekeeping");
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
420 needsReconstruct = true;
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
421 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
422 else
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
423 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
424 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Patient main dicom tags have changed but the trigger is disabled");
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
425 }
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
426 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
427
4982
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
428 if (last.studiesMainDicomTagsSignature != current.studiesMainDicomTagsSignature)
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
429 {
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
430 if (triggerOnMainDicomTagsChange_)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
431 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
432 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Study main dicom tags have changed, -> will perform housekeeping");
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
433 needsReconstruct = true;
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
434 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
435 else
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
436 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
437 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Study main dicom tags have changed but the trigger is disabled");
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
438 }
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
439 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
440
4982
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
441 if (last.seriesMainDicomTagsSignature != current.seriesMainDicomTagsSignature)
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
442 {
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
443 if (triggerOnMainDicomTagsChange_)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
444 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
445 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Series main dicom tags have changed, -> will perform housekeeping");
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
446 needsReconstruct = true;
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
447 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
448 else
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
449 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
450 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Series main dicom tags have changed but the trigger is disabled");
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
451 }
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
452 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
453
4982
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
454 if (last.instancesMainDicomTagsSignature != current.instancesMainDicomTagsSignature)
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
455 {
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
456 if (triggerOnMainDicomTagsChange_)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
457 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
458 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Instance main dicom tags have changed, -> will perform housekeeping");
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
459 needsReconstruct = true;
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
460 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
461 else
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
462 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
463 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: Instance main dicom tags have changed but the trigger is disabled");
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
464 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
465 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
466
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
467 if (current.storageCompressionEnabled != last.storageCompressionEnabled)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
468 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
469 if (triggerOnStorageCompressionChange_)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
470 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
471 if (current.storageCompressionEnabled)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
472 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
473 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: storage compression is now enabled -> will perform housekeeping");
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
474 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
475 else
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
476 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
477 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: storage compression is now disabled -> will perform housekeeping");
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
478 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
479
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
480 needsReingest = true;
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
481 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
482 else
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
483 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
484 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: storage compression has changed but the trigger is disabled");
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
485 }
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
486 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
487
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
488 if (current.ingestTranscoding != last.ingestTranscoding)
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
489 {
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
490 if (triggerOnIngestTranscodingChange_)
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
491 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
492 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: ingest transcoding has changed -> will perform housekeeping");
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
493
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
494 needsReingest = true;
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
495 }
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
496 else
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
497 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
498 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: ingest transcoding has changed but the trigger is disabled");
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
499 }
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
500 }
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
501
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
502 if (!current.dicomWebVersion.empty())
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
503 {
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
504 if (last.dicomWebVersion.empty())
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
505 {
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
506 if (triggerOnDicomWebCacheChange_)
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
507 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
508 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: DicomWEB plugin is enabled and the housekeeper has never run, you might miss series metadata cache -> will perform housekeeping");
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
509 }
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
510 needsDicomWebCaching = triggerOnDicomWebCacheChange_;
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
511 }
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
512 else
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
513 {
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
514 const char* lastDicomWebVersion = last.dicomWebVersion.c_str();
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
515
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
516 if (!OrthancPlugins::CheckMinimalVersion(lastDicomWebVersion, 1, 15, 0))
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
517 {
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
518 if (triggerOnDicomWebCacheChange_)
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
519 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
520 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: DicomWEB plugin might miss series metadata cache -> will perform housekeeping");
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
521 needsDicomWebCaching = true;
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
522 }
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
523 else
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
524 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
525 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: DicomWEB plugin might miss series metadata cache but the trigger has been disabled");
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
526 }
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
527 }
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
528 }
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
529 }
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
530 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
531
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
532 static bool ProcessChanges(bool needsReconstruct, bool needsReingest, bool needsDicomWebCaching, const DbConfiguration& currentDbConfiguration)
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
533 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
534 Json::Value changes;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
535
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
536 {
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
537 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_);
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
538
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
539 pluginStatus_.currentlyProcessingConfiguration = currentDbConfiguration;
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
540
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
541 OrthancPlugins::RestApiGet(changes, "/changes?since=" + boost::lexical_cast<std::string>(pluginStatus_.lastProcessedChange) + "&limit=100", false);
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
542 }
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
543
5223
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
544 if (changes["Changes"].size() > 0)
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
545 {
5223
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
546 for (Json::ArrayIndex i = 0; i < changes["Changes"].size(); i++)
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
547 {
5223
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
548 const Json::Value& change = changes["Changes"][i];
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
549 int64_t seq = change["Seq"].asInt64();
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
550
5558
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
551 if (!limitToChange_.empty()) // if updating only maindicomtags for a single level
5223
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
552 {
5558
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
553 if (change["ChangeType"] == limitToChange_)
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
554 {
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
555 Json::Value result;
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
556 Json::Value request;
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
557 request["ReconstructFiles"] = false;
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
558 request["LimitToThisLevelMainDicomTags"] = true;
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
559 OrthancPlugins::RestApiPost(result, "/" + limitToUrl_ + "/" + change["ID"].asString() + "/reconstruct", request, false);
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
560 }
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
561 }
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
562 else
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
563 {
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
564 if (change["ChangeType"] == "NewStudy") // some StableStudy might be missing if orthanc was shutdown during a StableAge -> consider only the NewStudy events that can not be missed
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
565 {
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
566 Json::Value result;
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
567
5558
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
568 if (needsReconstruct)
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
569 {
5558
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
570 Json::Value request;
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
571 if (needsReingest)
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
572 {
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
573 request["ReconstructFiles"] = true;
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
574 }
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
575 OrthancPlugins::RestApiPost(result, "/studies/" + change["ID"].asString() + "/reconstruct", request, false);
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
576 }
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
577
5558
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
578 if (needsDicomWebCaching)
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
579 {
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
580 Json::Value request;
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
581 OrthancPlugins::RestApiPost(result, "/studies/" + change["ID"].asString() + "/update-dicomweb-cache", request, true);
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
582 }
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
583 }
5223
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
584 }
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
585
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
586 {
5223
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
587 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_);
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
588
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
589 pluginStatus_.lastProcessedChange = seq;
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
590
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
591 if (seq >= pluginStatus_.lastChangeToProcess) // we are done !
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
592 {
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
593 return true;
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
594 }
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
595 }
5223
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
596
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
597 if (change["ChangeType"] == "NewStudy")
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
598 {
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
599 boost::this_thread::sleep(boost::posix_time::milliseconds(throttleDelay_ * 1000));
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
600 }
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
601 }
5223
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
602 }
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
603 else
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
604 {
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
605 // if the change list is empty and Done is true, it means that there is nothing to process anymore
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
606 if (changes["Done"].asBool())
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
607 {
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
608 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_);
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
609
5223
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
610 pluginStatus_.lastProcessedChange = changes["Last"].asInt64();
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
611
5223
a47b24f231d0 Fix Housekeeper plugin infinite loop if Orthanc is empty
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
612 return true;
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
613 }
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
614 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
615
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
616 return false;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
617 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
618
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
619
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
620 static void WorkerThread()
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
621 {
5452
8345267e8de5 Added OrthancPluginSetCurrentThreadName() in the plugin SDK
Alain Mazy <am@osimis.io>
parents: 5395
diff changeset
622 OrthancPluginSetCurrentThreadName(OrthancPlugins::GetGlobalContext(), "HOUSEKEEPER");
8345267e8de5 Added OrthancPluginSetCurrentThreadName() in the plugin SDK
Alain Mazy <am@osimis.io>
parents: 5395
diff changeset
623
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
624 DbConfiguration currentDbConfiguration;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
625
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
626 OrthancPluginLogWarning(OrthancPlugins::GetGlobalContext(), "Starting Housekeeper worker thread");
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
627
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
628 ReadStatusFromDb();
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
629
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
630 GetCurrentDbConfiguration(currentDbConfiguration);
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
631
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
632 bool needsReconstruct = false;
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
633 bool needsReingest = false;
5009
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
634 bool needsFullProcessing = false;
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
635 bool needsProcessing = false;
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
636 bool needsDicomWebCaching = false;
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
637
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
638 {
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
639 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_);
5009
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
640
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
641 // compare with last full processed configuration
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
642 CheckNeedsProcessing(needsReconstruct, needsReingest, needsDicomWebCaching, currentDbConfiguration, pluginStatus_.lastProcessedConfiguration);
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
643 needsFullProcessing = needsReconstruct || needsReingest || needsDicomWebCaching;
5009
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
644 needsProcessing = needsFullProcessing;
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
645
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
646 // if a processing was in progress, check if the config has changed since
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
647 if (pluginStatus_.currentlyProcessingConfiguration.IsDefined())
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
648 {
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
649 needsProcessing = true; // since a processing was in progress, we need at least a partial processing
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
650
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
651 bool needsReconstruct2 = false;
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
652 bool needsReingest2 = false;
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
653 bool needsDicomWebCaching2 = false;
5009
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
654
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
655 CheckNeedsProcessing(needsReconstruct2, needsReingest2, needsDicomWebCaching2, currentDbConfiguration, pluginStatus_.currentlyProcessingConfiguration);
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
656 needsFullProcessing = needsReconstruct2 || needsReingest2 || needsDicomWebCaching2; // if the configuration has changed compared to the config being processed, we need a full processing again
5009
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
657 }
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
658 }
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
659
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
660 if (!needsProcessing)
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
661 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
662 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: everything has been processed already !");
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
663 return;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
664 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
665
5009
ed4ceb31bcf8 Housekeeper plugin: Fix resume of previous processing
Alain Mazy <am@osimis.io>
parents: 4993
diff changeset
666 if (force_ || needsFullProcessing)
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
667 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
668 if (force_)
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
669 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
670 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: forcing execution -> will perform housekeeping");
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
671 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
672 else
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
673 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
674 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: the DB configuration has changed since last run, will reprocess the whole DB !");
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
675 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
676
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
677 Json::Value changes;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
678 OrthancPlugins::RestApiGet(changes, "/changes?last", false);
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
679
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
680 {
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
681 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_);
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
682
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
683 pluginStatus_.lastProcessedChange = 0;
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
684 pluginStatus_.lastChangeToProcess = changes["Last"].asInt64(); // the last change is the last change at the time we start. We assume that every new ingested file will be constructed correctly
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
685 pluginStatus_.lastTimeStarted = boost::posix_time::microsec_clock::universal_time();
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
686 }
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
687 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
688 else
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
689 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
690 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper: the DB configuration has not changed since last run, will continue processing changes");
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
691 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
692
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
693 bool completed = false;
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
694 {
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
695 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_);
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
696 completed = pluginStatus_.lastChangeToProcess == 0; // if the DB is empty at start, no need to process anyting
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
697 }
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
698
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
699 bool loggedNotRightPeriodChangeMessage = false;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
700
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
701 while (!workerThreadShouldStop_ && !completed)
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
702 {
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
703 if (runningPeriods_.isInPeriod())
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
704 {
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
705 completed = ProcessChanges(needsReconstruct, needsReingest, needsDicomWebCaching, currentDbConfiguration);
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
706 SaveStatusInDb();
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
707
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
708 if (!completed)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
709 {
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
710 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_);
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
711
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
712 ORTHANC_PLUGINS_LOG_INFO("Housekeeper: processed changes " + boost::lexical_cast<std::string>(pluginStatus_.lastProcessedChange) +
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
713 " / " + boost::lexical_cast<std::string>(pluginStatus_.lastChangeToProcess));
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
714
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
715 boost::this_thread::sleep(boost::posix_time::milliseconds(throttleDelay_ * 100)); // wait 1/10 of the delay between changes
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
716 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
717
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
718 loggedNotRightPeriodChangeMessage = false;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
719 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
720 else
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
721 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
722 if (!loggedNotRightPeriodChangeMessage)
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
723 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
724 ORTHANC_PLUGINS_LOG_INFO("Housekeeper: entering quiet period");
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
725 loggedNotRightPeriodChangeMessage = true;
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
726 }
5395
c1037a755cee housekeeper: added sleep when idle
Alain Mazy <am@osimis.io>
parents: 5376
diff changeset
727
c1037a755cee housekeeper: added sleep when idle
Alain Mazy <am@osimis.io>
parents: 5376
diff changeset
728 boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
729 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
730 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
731
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
732 if (completed)
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
733 {
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
734 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_);
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
735
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
736 pluginStatus_.lastProcessedConfiguration = currentDbConfiguration;
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
737 pluginStatus_.currentlyProcessingConfiguration.Clear();
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
738
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
739 pluginStatus_.lastProcessedChange = -1;
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
740 pluginStatus_.lastChangeToProcess = -1;
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
741
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
742 SaveStatusInDb();
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
743
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
744 OrthancPluginLogWarning(OrthancPlugins::GetGlobalContext(), "Housekeeper: finished processing all changes");
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
745 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
746 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
747
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
748 extern "C"
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
749 {
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
750 OrthancPluginErrorCode GetPluginStatus(OrthancPluginRestOutput* output,
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
751 const char* url,
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
752 const OrthancPluginHttpRequest* request)
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
753 {
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
754 if (request->method != OrthancPluginHttpMethod_Get)
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
755 {
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
756 OrthancPlugins::AnswerMethodNotAllowed(output, "GET");
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
757 }
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
758 else
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
759 {
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
760 boost::recursive_mutex::scoped_lock lock(pluginStatusMutex_);
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
761
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
762 Json::Value status;
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
763 pluginStatus_.ToJson(status);
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
764
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
765 OrthancPlugins::AnswerJson(status, output);
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
766 }
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
767
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
768 return OrthancPluginErrorCode_Success;
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
769 }
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
770
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
771
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
772 OrthancPluginErrorCode OnChangeCallback(OrthancPluginChangeType changeType,
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
773 OrthancPluginResourceType resourceType,
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
774 const char* resourceId)
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
775 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
776 switch (changeType)
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
777 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
778 case OrthancPluginChangeType_OrthancStarted:
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
779 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
780 workerThread_.reset(new boost::thread(WorkerThread));
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
781 return OrthancPluginErrorCode_Success;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
782 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
783 case OrthancPluginChangeType_OrthancStopped:
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
784 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
785 if (workerThread_ && workerThread_->joinable())
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
786 {
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
787 workerThreadShouldStop_ = true;
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
788 workerThread_->join();
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
789 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
790 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
791 default:
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
792 return OrthancPluginErrorCode_Success;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
793 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
794 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
795
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
796 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c)
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
797 {
5563
e02cdf358905 fix plugin init wrt logging
Alain Mazy <am@orthanc.team>
parents: 5561
diff changeset
798 OrthancPlugins::SetGlobalContext(c, HOUSEKEEPER_NAME);
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
799
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
800 /* Check the version of the Orthanc core */
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
801 if (OrthancPluginCheckVersion(c) == 0)
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
802 {
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
803 OrthancPlugins::ReportMinimalOrthancVersion(ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
804 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER,
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
805 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
806 return -1;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
807 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
808
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
809 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper plugin is initializing");
5538
6ce05f8b5b13 deprecating OrthancPluginSetDescription2(), OrthancPluginExtendOrthancExplorer2() and OrthancPluginSetRootUri2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
810 OrthancPluginSetDescription2(c, HOUSEKEEPER_NAME, "Optimizes your DB and storage.");
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
811
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
812 OrthancPlugins::OrthancConfiguration orthancConfiguration;
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
813
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
814 OrthancPlugins::OrthancConfiguration housekeeper;
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
815 orthancConfiguration.GetSection(housekeeper, "Housekeeper");
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
816
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
817 bool enabled = housekeeper.GetBooleanValue("Enable", false);
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
818 if (enabled)
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
819 {
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
820 /*
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
821 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
822 "Housekeeper": {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
823
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
824 // Enables/disables the plugin
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
825 "Enable": false,
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
826
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
827 // the Global Prooperty ID in which the plugin progress
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
828 // is stored. Must be > 1024 and must not be used by
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
829 // another plugin
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
830 "GlobalPropertyId": 1025,
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
831
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
832 // Forces execution even if the plugin did not detect
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
833 // any changes in configuration
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
834 "Force": false,
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
835
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
836 // Delay (in seconds) between reconstruction of 2 studies
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
837 // This avoids overloading Orthanc with the housekeeping
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
838 // process and leaves room for other operations.
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
839 "ThrottleDelay": 5,
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
840
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
841 // Runs the plugin only at certain period of time.
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
842 // If not specified, the plugin runs all the time
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
843 // Examples:
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
844 // to run between 0AM and 6AM everyday + every night
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
845 // from 8PM to 12PM and 24h a day on the weekend:
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
846 // "Schedule": {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
847 // "Monday": ["0-6", "20-24"],
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
848 // "Tuesday": ["0-6", "20-24"],
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
849 // "Wednesday": ["0-6", "20-24"],
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
850 // "Thursday": ["0-6", "20-24"],
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
851 // "Friday": ["0-6", "20-24"],
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
852 // "Saturday": ["0-24"],
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
853 // "Sunday": ["0-24"]
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
854 // },
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
855
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
856 // configure events that can trigger a housekeeping processing
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
857 "Triggers" : {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
858 "StorageCompressionChange": true,
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
859 "MainDicomTagsChange": true,
5376
4ab905749aed fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents: 5375
diff changeset
860 "UnnecessaryDicomAsJsonFiles": true,
4ab905749aed fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents: 5375
diff changeset
861 "DicomWebCacheChange": true // new in 1.12.2
5558
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
862 },
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
863
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
864 // When rebuilding MainDicomTags, limit to a single level of resource.
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
865 // Allowed values: "Patient", "Study", "Series", "Instance"
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
866 "LimitMainDicomTagsReconstructLevel": "Study"
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
867
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
868 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
869 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
870 */
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
871
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
872
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
873 globalPropertyId_ = housekeeper.GetIntegerValue("GlobalPropertyId", 1025);
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
874 force_ = housekeeper.GetBooleanValue("Force", false);
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
875 throttleDelay_ = housekeeper.GetUnsignedIntegerValue("ThrottleDelay", 5);
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
876
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
877 if (housekeeper.GetJson().isMember("Triggers"))
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
878 {
5376
4ab905749aed fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents: 5375
diff changeset
879 OrthancPlugins::OrthancConfiguration triggers;
4ab905749aed fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents: 5375
diff changeset
880 housekeeper.GetSection(triggers, "Triggers");
4ab905749aed fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents: 5375
diff changeset
881 triggerOnStorageCompressionChange_ = triggers.GetBooleanValue("StorageCompressionChange", true);
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
882
5376
4ab905749aed fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents: 5375
diff changeset
883 triggerOnMainDicomTagsChange_ = triggers.GetBooleanValue("MainDicomTagsChange", true);
4ab905749aed fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents: 5375
diff changeset
884 triggerOnUnnecessaryDicomAsJsonFiles_ = triggers.GetBooleanValue("UnnecessaryDicomAsJsonFiles", true);
4ab905749aed fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents: 5375
diff changeset
885 triggerOnIngestTranscodingChange_ = triggers.GetBooleanValue("IngestTranscodingChange", true);
4ab905749aed fix Housekeeper plugin triggers configuration
Alain Mazy <am@osimis.io>
parents: 5375
diff changeset
886 triggerOnDicomWebCacheChange_ = triggers.GetBooleanValue("DicomWebCacheChange", true);
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
887 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
888
5558
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
889 limitMainDicomTagsReconstructLevel_ = housekeeper.GetStringValue("LimitMainDicomTagsReconstructLevel", "");
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
890 if (limitMainDicomTagsReconstructLevel_ != "Patient" && limitMainDicomTagsReconstructLevel_ != "Study"
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
891 && limitMainDicomTagsReconstructLevel_ != "Series" && limitMainDicomTagsReconstructLevel_ != "Instance")
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
892 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
893 ORTHANC_PLUGINS_LOG_ERROR("Housekeeper invalid value for 'LimitMainDicomTagsReconstructLevel': '" + limitMainDicomTagsReconstructLevel_ + "'");
5558
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
894 }
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
895 else if (limitMainDicomTagsReconstructLevel_ == "Patient")
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
896 {
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
897 limitToChange_ = "NewPatient";
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
898 limitToUrl_ = "patients";
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
899 }
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
900 else if (limitMainDicomTagsReconstructLevel_ == "Study")
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
901 {
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
902 limitToChange_ = "NewStudy";
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
903 limitToUrl_ = "studies";
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
904 }
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
905 else if (limitMainDicomTagsReconstructLevel_ == "Series")
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
906 {
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
907 limitToChange_ = "NewSeries";
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
908 limitToUrl_ = "series";
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
909 }
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
910 else if (limitMainDicomTagsReconstructLevel_ == "Instance")
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
911 {
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
912 limitToChange_ = "NewInstance";
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
913 limitToUrl_ = "instances";
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
914 }
c1ed59a5bdc2 new LimitToThisLevelMainDicomTags reconstruct mode + * Housekeeper plugin: Added an option LimitMainDicomTagsReconstructLevel
Alain Mazy <am@orthanc.team>
parents: 5538
diff changeset
915
4979
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
916 if (housekeeper.GetJson().isMember("Schedule"))
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
917 {
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
918 runningPeriods_.load(housekeeper.GetJson()["Schedule"]);
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
919 }
f316413027fd renamed DbOptizer into Housekeeper + add Scheduler & triggers
Alain Mazy <am@osimis.io>
parents: 4961
diff changeset
920
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
921 OrthancPluginRegisterOnChangeCallback(c, OnChangeCallback);
5375
984300e70069 updated Housekeeper plugin to handle DicomWeb cache
Alain Mazy <am@osimis.io>
parents: 5280
diff changeset
922 OrthancPluginRegisterRestCallback(c, "/housekeeper/status", GetPluginStatus); // for backward compatiblity with version 1.11.0
5035
67d98fccc850 uniformize /plugins/../status
Alain Mazy <am@osimis.io>
parents: 5009
diff changeset
923 OrthancPluginRegisterRestCallback(c, "/plugins/housekeeper/status", GetPluginStatus);
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
924 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
925 else
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
926 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
927 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper plugin is disabled by the configuration file");
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
928 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
929
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
930 return 0;
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
931 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
932
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
933
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
934 ORTHANC_PLUGINS_API void OrthancPluginFinalize()
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
935 {
5573
823aae1ea72a removed dependency of HouseKeeper upon Orthanc::Logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5563
diff changeset
936 ORTHANC_PLUGINS_LOG_WARNING("Housekeeper plugin is finalizing");
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
937 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
938
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
939
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
940 ORTHANC_PLUGINS_API const char* OrthancPluginGetName()
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
941 {
5538
6ce05f8b5b13 deprecating OrthancPluginSetDescription2(), OrthancPluginExtendOrthancExplorer2() and OrthancPluginSetRootUri2()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
942 return HOUSEKEEPER_NAME;
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
943 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
944
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
945
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
946 ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion()
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
947 {
4981
d0c34145320c cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4979
diff changeset
948 return HOUSEKEEPER_VERSION;
4961
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
949 }
1b76853e1797 DbOptimizer plugin
Alain Mazy <am@osimis.io>
parents:
diff changeset
950 }