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 2014/10/22 19:16:19 UTC

git commit: Created mesos::modules namespace for all module related code.

Repository: mesos
Updated Branches:
  refs/heads/master e960cdffe -> eebced480


Created mesos::modules namespace for all module related code.

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


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

Branch: refs/heads/master
Commit: eebced480c291c818b9c54ced034978fdb8526c8
Parents: e960cdf
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Wed Oct 22 09:28:56 2014 -0700
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Wed Oct 22 09:57:53 2014 -0700

----------------------------------------------------------------------
 include/mesos/module.hpp             |  2 ++
 src/examples/example_module_impl.cpp |  2 +-
 src/examples/test_module.hpp         |  2 ++
 src/master/main.cpp                  |  1 +
 src/module/manager.cpp               | 12 ++++++------
 src/module/manager.hpp               | 11 +++++------
 src/slave/main.cpp                   |  1 +
 src/tests/module_tests.cpp           |  3 ++-
 8 files changed, 20 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/eebced48/include/mesos/module.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/module.hpp b/include/mesos/module.hpp
index 5205e30..477acfd 100644
--- a/include/mesos/module.hpp
+++ b/include/mesos/module.hpp
@@ -49,6 +49,7 @@
 #define MESOS_MODULE_API_VERSION "1"
 
 namespace mesos {
+namespace modules {
 
 // Internal utilities, not part of the module API:
 
@@ -97,6 +98,7 @@ struct ModuleBase
 template <typename T>
 struct Module;
 
+} // namespace modules {
 } // namespace mesos {
 
 #endif // __MESOS_MODULE_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/eebced48/src/examples/example_module_impl.cpp
----------------------------------------------------------------------
diff --git a/src/examples/example_module_impl.cpp b/src/examples/example_module_impl.cpp
index 169453a..6a48d67 100644
--- a/src/examples/example_module_impl.cpp
+++ b/src/examples/example_module_impl.cpp
@@ -56,7 +56,7 @@ static TestModule* create()
 // checks.
 // create() hook returns an object of type 'TestModule'.
 // Mesos core binds the module instance pointer as needed.
-mesos::Module<TestModule> org_apache_mesos_TestModule(
+mesos::modules::Module<TestModule> org_apache_mesos_TestModule(
     MESOS_MODULE_API_VERSION,
     MESOS_VERSION,
     "Apache Mesos",

http://git-wip-us.apache.org/repos/asf/mesos/blob/eebced48/src/examples/test_module.hpp
----------------------------------------------------------------------
diff --git a/src/examples/test_module.hpp b/src/examples/test_module.hpp
index b5cc2fa..7e22fb7 100644
--- a/src/examples/test_module.hpp
+++ b/src/examples/test_module.hpp
@@ -43,6 +43,7 @@ public:
 
 
 namespace mesos {
+namespace modules {
 
 template <>
 struct Module<TestModule> : ModuleBase
@@ -69,6 +70,7 @@ struct Module<TestModule> : ModuleBase
   TestModule* (*create)();
 };
 
+} // namespace modules {
 } // namespace mesos {
 
 #endif // __TEST_MODULE_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/eebced48/src/master/main.cpp
----------------------------------------------------------------------
diff --git a/src/master/main.cpp b/src/master/main.cpp
index 29ded49..193d53f 100644
--- a/src/master/main.cpp
+++ b/src/master/main.cpp
@@ -69,6 +69,7 @@ using namespace mesos::internal::master;
 using namespace zookeeper;
 
 using mesos::MasterInfo;
+using mesos::modules::ModuleManager;
 
 using process::Owned;
 using process::UPID;

http://git-wip-us.apache.org/repos/asf/mesos/blob/eebced48/src/module/manager.cpp
----------------------------------------------------------------------
diff --git a/src/module/manager.cpp b/src/module/manager.cpp
index 105e5af..1e71e1f 100644
--- a/src/module/manager.cpp
+++ b/src/module/manager.cpp
@@ -28,15 +28,18 @@
 #include <stout/stringify.hpp>
 #include <stout/version.hpp>
 
-#include "manager.hpp"
+#include "common/lock.hpp"
+#include "messages/messages.hpp"
+#include "module/manager.hpp"
 
 using std::list;
 using std::string;
 using std::vector;
 using process::Owned;
 
-namespace mesos {
-namespace internal {
+using namespace mesos;
+using namespace mesos::internal;
+using namespace mesos::modules;
 
 pthread_mutex_t ModuleManager::mutex = PTHREAD_MUTEX_INITIALIZER;
 hashmap<const string, string> ModuleManager::kindToVersion;
@@ -223,6 +226,3 @@ Try<Nothing> ModuleManager::load(const Modules& modules)
 
   return Nothing();
 }
-
-} // namespace internal {
-} // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/eebced48/src/module/manager.hpp
----------------------------------------------------------------------
diff --git a/src/module/manager.hpp b/src/module/manager.hpp
index 1c93ac4..65d54f1 100644
--- a/src/module/manager.hpp
+++ b/src/module/manager.hpp
@@ -30,8 +30,6 @@
 #include <mesos/mesos.hpp>
 #include <mesos/module.hpp>
 
-#include <messages/messages.hpp>
-
 #include <process/owned.hpp>
 
 #include <stout/check.hpp>
@@ -39,9 +37,10 @@
 #include <stout/hashmap.hpp>
 
 #include "common/lock.hpp"
+#include "messages/messages.hpp"
 
 namespace mesos {
-namespace internal {
+namespace modules {
 
 // Mesos module loading.
 //
@@ -64,13 +63,13 @@ public:
   //
   // NOTE: If loading fails at a particular library we don't unload
   // all of the already loaded libraries.
-  static Try<Nothing> load(const Modules& modules);
+  static Try<Nothing> load(const mesos::internal::Modules& modules);
 
   // create() should be called only after load().
   template <typename Kind>
   static Try<Kind*> create(const std::string& moduleName)
   {
-    Lock lock(&mutex);
+    mesos::internal::Lock lock(&mutex);
     if (!moduleBases.contains(moduleName)) {
       return Error(
           "Module '" + moduleName + "' unknown");
@@ -118,7 +117,7 @@ private:
     dynamicLibraries;
 };
 
-} // namespace internal {
+} // namespace modules {
 } // namespace mesos {
 
 #endif // __MODULE_MANAGER_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/eebced48/src/slave/main.cpp
----------------------------------------------------------------------
diff --git a/src/slave/main.cpp b/src/slave/main.cpp
index bf56f69..087944a 100644
--- a/src/slave/main.cpp
+++ b/src/slave/main.cpp
@@ -44,6 +44,7 @@
 using namespace mesos::internal;
 using namespace mesos::internal::slave;
 
+using mesos::modules::ModuleManager;
 using mesos::SlaveInfo;
 
 using std::cerr;

http://git-wip-us.apache.org/repos/asf/mesos/blob/eebced48/src/tests/module_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/module_tests.cpp b/src/tests/module_tests.cpp
index e92d871..532ff50 100644
--- a/src/tests/module_tests.cpp
+++ b/src/tests/module_tests.cpp
@@ -33,6 +33,7 @@ using std::string;
 using namespace mesos;
 using namespace mesos::internal;
 using namespace mesos::internal::tests;
+using namespace mesos::modules;
 
 const char* DEFAULT_MODULE_LIBRARY_NAME = "examplemodule";
 const char* DEFAULT_MODULE_NAME = "org_apache_mesos_TestModule";
@@ -112,7 +113,7 @@ protected:
   Result<TestModule*> module;
 
   static DynamicLibrary dynamicLibrary;
-  static mesos::ModuleBase* moduleBase;
+  static ModuleBase* moduleBase;
   static string originalLdLibraryPath;
   static string libraryDirectory;
 };