summaryrefslogtreecommitdiff
path: root/src/mongo/util/periodic_runner.h
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2018-05-09 16:56:02 -0400
committerJason Carey <jcarey@argv.me>2018-05-10 19:49:37 -0400
commit714b97ba9c7dd8de3351eb811befce6c4b6efd63 (patch)
tree8d0412fe26082fcce784cf39daaa4974fb951b3d /src/mongo/util/periodic_runner.h
parent9c001939d82c4522a8cb071b4285b1f1718b81cf (diff)
downloadmongo-714b97ba9c7dd8de3351eb811befce6c4b6efd63.tar.gz
SERVER-34923 PeriodicRunnerASIO -> Impl
Replace PeriodicRunnerASIO with PeriodicRunnerImpl, a simpler interface that runs jobs on dedicated threads.
Diffstat (limited to 'src/mongo/util/periodic_runner.h')
-rw-r--r--src/mongo/util/periodic_runner.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/mongo/util/periodic_runner.h b/src/mongo/util/periodic_runner.h
index 6b80226aa55..710b812bb73 100644
--- a/src/mongo/util/periodic_runner.h
+++ b/src/mongo/util/periodic_runner.h
@@ -28,6 +28,8 @@
#pragma once
+#include <string>
+
#include "mongo/base/disallow_copying.h"
#include "mongo/stdx/functional.h"
#include "mongo/util/time_support.h"
@@ -51,8 +53,13 @@ public:
using Job = stdx::function<void(Client* client)>;
struct PeriodicJob {
- PeriodicJob(Job callable, Milliseconds period)
- : job(std::move(callable)), interval(period) {}
+ PeriodicJob(std::string name, Job callable, Milliseconds period)
+ : name(std::move(name)), job(std::move(callable)), interval(period) {}
+
+ /**
+ * name of the job
+ */
+ std::string name;
/**
* A task to be run at regular intervals by the runner.
@@ -60,7 +67,7 @@ public:
Job job;
/**
- * An interval at which the job should be run. Defaults to 1 minute.
+ * An interval at which the job should be run.
*/
Milliseconds interval;
};
@@ -79,10 +86,9 @@ public:
* Starts up this periodic runner.
*
* This method may safely be called multiple times, either with or without
- * calls to shutdown() in between, but implementations may choose whether to
- * restart or error on subsequent calls to startup().
+ * calls to shutdown() in between.
*/
- virtual Status startup() = 0;
+ virtual void startup() = 0;
/**
* Shuts down this periodic runner. Stops all jobs from running.