RStudio Launcher Plugin SDK  1.1.3
A software development kit for creating plugins that work the the RStudio Launcher.
AbstractTimedJobStatusWatcher.hpp
1 /*
2  * AbstractTimedJobStatusWatcher.hpp
3  *
4  * Copyright (C) 2020 by RStudio, PBC
5  *
6  * Unless you have received this program directly from RStudio pursuant to the terms of a commercial license agreement
7  * with RStudio, then this program is licensed to you under the following terms:
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
10  * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
11  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
15  * Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18  * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  */
23 
24 #ifndef LAUNCHER_PLUGINS_ABSTRACT_TIMED_JOB_STATUS_WATCHER_HPP
25 #define LAUNCHER_PLUGINS_ABSTRACT_TIMED_JOB_STATUS_WATCHER_HPP
26 
27 #include <jobs/AbstractJobStatusWatcher.hpp>
28 
29 #include <memory>
30 
31 #include <PImpl.hpp>
32 
33 namespace rstudio {
34 namespace launcher_plugins {
35 namespace jobs {
36 
42  public std::enable_shared_from_this<AbstractTimedJobStatusWatcher>
43 {
44 public:
48  ~AbstractTimedJobStatusWatcher() noexcept override;
49 
53  Error start() final;
54 
58  void stop() final;
59 
60 protected:
69  system::TimeDuration in_frequency,
70  JobRepositoryPtr in_jobRepository,
71  JobStatusNotifierPtr in_jobStatusNotifier);
72 
73 private:
86  virtual Error pollJobStatus() = 0;
87 
88  PRIVATE_IMPL(m_timedBaseImpl);
89 };
90 
91 } // namespace jobs
92 } // namespace launcher_plugins
93 } // namespace rstudio
94 
95 #endif
rstudio::launcher_plugins::jobs::AbstractTimedJobStatusWatcher::~AbstractTimedJobStatusWatcher
~AbstractTimedJobStatusWatcher() noexcept override
Virtual destructor for inheritance. Invokes stop().
rstudio::launcher_plugins::jobs::AbstractTimedJobStatusWatcher::AbstractTimedJobStatusWatcher
AbstractTimedJobStatusWatcher(system::TimeDuration in_frequency, JobRepositoryPtr in_jobRepository, JobStatusNotifierPtr in_jobStatusNotifier)
Constructor.
rstudio::launcher_plugins::jobs::AbstractJobStatusWatcher
Manages posting job status updates to the notifier.
Definition: AbstractJobStatusWatcher.hpp:42
rstudio::launcher_plugins::Error
Class which represents an error.
Definition: Error.hpp:174
rstudio::launcher_plugins::jobs::AbstractTimedJobStatusWatcher
Responsible for polling job statuses on a timer.
Definition: AbstractTimedJobStatusWatcher.hpp:40
rstudio::launcher_plugins::system::TimeDuration
Represents an duration of time (e.g. 5 hours, 43 minutes, and 21 seconds) as opposed to a point in ti...
Definition: DateTime.hpp:48
rstudio::launcher_plugins::jobs::AbstractTimedJobStatusWatcher::stop
void stop() final
Stops the timed job status watcher.
rstudio::launcher_plugins::jobs::AbstractTimedJobStatusWatcher::start
Error start() final
Starts the timed job status watcher.