You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by nn...@apache.org on 2015/04/21 21:56:30 UTC

[4/9] mesos git commit: Added support for allocator modules.

Added support for allocator modules.

Review: https://reviews.apache.org/r/31266


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/079fc0af
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/079fc0af
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/079fc0af

Branch: refs/heads/master
Commit: 079fc0af9600b5407b37cbc6145b99a27a09201c
Parents: aabebb1
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Tue Apr 21 12:10:51 2015 -0700
Committer: Niklas Q. Nielsen <ni...@qni.dk>
Committed: Tue Apr 21 12:10:52 2015 -0700

----------------------------------------------------------------------
 include/mesos/module/allocator.hpp | 65 +++++++++++++++++++++++++++++++++
 src/Makefile.am                    |  1 +
 src/module/manager.cpp             |  1 +
 3 files changed, 67 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/079fc0af/include/mesos/module/allocator.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/module/allocator.hpp b/include/mesos/module/allocator.hpp
new file mode 100644
index 0000000..376eb48
--- /dev/null
+++ b/include/mesos/module/allocator.hpp
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MESOS_MODULE_ALLOCATOR_HPP__
+#define __MESOS_MODULE_ALLOCATOR_HPP__
+
+#include <mesos/mesos.hpp>
+#include <mesos/module.hpp>
+
+#include <mesos/master/allocator.hpp>
+
+namespace mesos {
+namespace modules {
+
+template <>
+inline const char* kind<mesos::master::allocator::Allocator>()
+{
+  return "Allocator";
+}
+
+
+template <>
+struct Module<mesos::master::allocator::Allocator> : ModuleBase
+{
+  Module(
+      const char* _moduleApiVersion,
+      const char* _mesosVersion,
+      const char* _authorName,
+      const char* _authorEmail,
+      const char* _description,
+      bool (*_compatible)(),
+      mesos::master::allocator::Allocator*
+        (*_create)(const Parameters& parameters))
+    : ModuleBase(
+        _moduleApiVersion,
+        _mesosVersion,
+        mesos::modules::kind<mesos::master::allocator::Allocator>(),
+        _authorName,
+        _authorEmail,
+        _description,
+        _compatible),
+      create(_create) {}
+
+  mesos::master::allocator::Allocator* (*create)(const Parameters& parameters);
+};
+
+} // namespace modules {
+} // namespace mesos {
+
+#endif // __MESOS_MODULE_ALLOCATOR_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/079fc0af/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 5751e96..afca3c8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -429,6 +429,7 @@ nodist_master_HEADERS = ../include/mesos/master/allocator.pb.h
 moduledir = $(pkgincludedir)/module
 
 module_HEADERS =							\
+  $(top_srcdir)/include/mesos/module/allocator.hpp			\
   $(top_srcdir)/include/mesos/module/anonymous.hpp			\
   $(top_srcdir)/include/mesos/module/authenticatee.hpp			\
   $(top_srcdir)/include/mesos/module/authenticator.hpp			\

http://git-wip-us.apache.org/repos/asf/mesos/blob/079fc0af/src/module/manager.cpp
----------------------------------------------------------------------
diff --git a/src/module/manager.cpp b/src/module/manager.cpp
index 82a38f0..5fed1aa 100644
--- a/src/module/manager.cpp
+++ b/src/module/manager.cpp
@@ -62,6 +62,7 @@ void ModuleManager::initialize()
   // current change.  Typically that should be the version currently
   // under development.
 
+  kindToVersion["Allocator"] = MESOS_VERSION;
   kindToVersion["Anonymous"] = MESOS_VERSION;
   kindToVersion["Authenticatee"] = MESOS_VERSION;
   kindToVersion["Authenticator"] = MESOS_VERSION;