You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2016/08/02 15:42:46 UTC
[4/7] mesos git commit: Added a abstract base class for scheduler
library.
Added a abstract base class for scheduler library.
This change adds an abstract base class `MesosBase` that
would be used by implementations for interacting with
Mesos via the Scheduler API. This is needed later for
implementing the V0->V1 Scheduler Adapter.
Review: https://reviews.apache.org/r/50247
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e184216b
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e184216b
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e184216b
Branch: refs/heads/master
Commit: e184216b299424fc6b7b241fd9caeb7e2f209306
Parents: 9567fb4
Author: Anand Mazumdar <an...@apache.org>
Authored: Tue Jul 19 17:28:27 2016 -0700
Committer: Anand Mazumdar <an...@apache.org>
Committed: Tue Aug 2 08:25:48 2016 -0700
----------------------------------------------------------------------
include/mesos/v1/scheduler.hpp | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/e184216b/include/mesos/v1/scheduler.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/v1/scheduler.hpp b/include/mesos/v1/scheduler.hpp
index 18e7a95..d56e088 100644
--- a/include/mesos/v1/scheduler.hpp
+++ b/include/mesos/v1/scheduler.hpp
@@ -41,8 +41,19 @@ namespace scheduler {
class MesosProcess; // Forward declaration.
-// Interface to Mesos for a scheduler. Abstracts master detection
-// (connection and disconnection).
+// Abstract interface for connecting a scheduler to Mesos.
+class MesosBase
+{
+public:
+ // Empty virtual destructor (necessary to instantiate subclasses).
+ virtual ~MesosBase() {}
+ virtual void send(const Call& call) = 0;
+ virtual void reconnect() = 0;
+};
+
+
+// Concrete implementation that connects a scheduler to a Mesos master.
+// Abstracts master detection (connection and disconnection).
//
// Expects three callbacks, 'connected', 'disconnected', and
// 'received' which will get invoked _serially_ when it's determined
@@ -51,7 +62,7 @@ class MesosProcess; // Forward declaration.
// The library reconnects with the master upon a disconnection.
//
// NOTE: All calls and events are dropped while disconnected.
-class Mesos
+class Mesos : public MesosBase
{
public:
// The credential will be used for authenticating with the master. Currently,
@@ -81,7 +92,7 @@ public:
// events without ever being sent to the master. This includes when
// calls are sent but no master is currently detected (i.e., we're
// disconnected).
- virtual void send(const Call& call);
+ virtual void send(const Call& call) override;
// Force a reconnection with the master.
//
@@ -94,7 +105,7 @@ public:
// This call would be ignored if the scheduler is already disconnected with
// the master (e.g., no new master has been elected). Otherwise, the scheduler
// would get a 'disconnected' callback followed by a 'connected' callback.
- virtual void reconnect();
+ virtual void reconnect() override;
protected:
// NOTE: This constructor is used for testing.