Mercurial > hg > orthanc
diff Core/JobsEngine/JobsRegistry.h @ 4027:3a77d4073adf
merge
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 09 Jun 2020 16:33:08 +0200 |
parents | 1d2b31fc782f |
children |
line wrap: on
line diff
--- a/Core/JobsEngine/JobsRegistry.h Tue Jun 09 16:26:57 2020 +0200 +++ b/Core/JobsEngine/JobsRegistry.h Tue Jun 09 16:33:08 2020 +0200 @@ -20,7 +20,7 @@ * you do not wish to do so, delete this exception statement from your * version. If you delete this exception statement from all source files * in the program, then also delete it here. - * + * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -69,7 +69,7 @@ virtual void SignalJobFailure(const std::string& jobId) = 0; }; - + private: enum CompletedReason { @@ -77,7 +77,7 @@ CompletedReason_Failure, CompletedReason_Canceled }; - + class JobHandler; struct PriorityComparator @@ -89,7 +89,7 @@ typedef std::map<std::string, JobHandler*> JobsIndex; typedef std::list<JobHandler*> CompletedJobs; typedef std::set<JobHandler*> RetryJobs; - typedef std::priority_queue<JobHandler*, + typedef std::priority_queue<JobHandler*, std::vector<JobHandler*>, // Could be a "std::deque" PriorityComparator> PendingJobs; @@ -110,7 +110,7 @@ bool IsPendingJob(const JobHandler& job) const; bool IsCompletedJob(JobHandler& job) const; - + bool IsRetryJob(JobHandler& job) const; #endif @@ -120,25 +120,25 @@ void SetCompletedJob(JobHandler& job, bool success); - + void MarkRunningAsCompleted(JobHandler& job, CompletedReason reason); void MarkRunningAsRetry(JobHandler& job, unsigned int timeout); - + void MarkRunningAsPaused(JobHandler& job); - + bool GetStateInternal(JobState& state, const std::string& id); void RemovePendingJob(const std::string& id); - + void RemoveRetryJob(JobHandler* handler); - + void SubmitInternal(std::string& id, JobHandler* handler); - + public: JobsRegistry(size_t maxCompletedJobs) : maxCompletedJobs_(maxCompletedJobs), @@ -153,7 +153,7 @@ ~JobsRegistry(); void SetMaxCompletedJobs(size_t i); - + size_t GetMaxCompletedJobs(); void ListJobs(std::set<std::string>& target); @@ -167,31 +167,31 @@ const std::string& key); void Serialize(Json::Value& target); - + void Submit(std::string& id, IJob* job, // Takes ownership int priority); - + void Submit(IJob* job, // Takes ownership int priority); void SubmitAndWait(Json::Value& successContent, IJob* job, // Takes ownership int priority); - + bool SetPriority(const std::string& id, int priority); bool Pause(const std::string& id); - + bool Resume(const std::string& id); bool Resubmit(const std::string& id); bool Cancel(const std::string& id); - + void ScheduleRetries(); - + bool GetState(JobState& state, const std::string& id); @@ -219,7 +219,7 @@ JobState targetState_; unsigned int targetRetryTimeout_; bool canceled_; - + public: RunningJob(JobsRegistry& registry, unsigned int timeout);