Moved allocator to public headers.

This is required for out-of-tree allocator modules. RoleInfo protobuf
message has to be extracted into its own public proto file.

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


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

Branch: refs/heads/master
Commit: f1fc3d76de93b0149e2797e3923f4bf939037c98
Parents: 97dce73
Author: Alexander Rukletsov <[email protected]>
Authored: Tue Apr 21 12:10:07 2015 -0700
Committer: Niklas Q. Nielsen <[email protected]>
Committed: Tue Apr 21 12:10:11 2015 -0700

----------------------------------------------------------------------
 include/mesos/master/allocator.hpp              | 130 +++++++++++++++++++
 include/mesos/master/allocator.proto            |  27 ++++
 src/Makefile.am                                 |  23 +++-
 src/local/local.cpp                             |   6 +-
 src/local/local.hpp                             |  14 +-
 src/master/allocator/allocator.hpp              | 129 ------------------
 src/master/allocator/mesos/allocator.hpp        |   6 +-
 src/master/main.cpp                             |   6 +-
 src/master/master.cpp                           |   6 +-
 src/master/master.hpp                           |  11 +-
 src/messages/messages.proto                     |   9 --
 src/tests/cluster.hpp                           |   9 +-
 src/tests/fault_tolerance_tests.cpp             |   4 +-
 src/tests/hierarchical_allocator_tests.cpp      |   5 +-
 src/tests/master_allocator_tests.cpp            |   5 +-
 src/tests/master_authorization_tests.cpp        |   4 +-
 src/tests/master_slave_reconciliation_tests.cpp |   4 +-
 src/tests/master_tests.cpp                      |   4 +-
 src/tests/mesos.cpp                             |   2 +-
 src/tests/mesos.hpp                             |  10 +-
 src/tests/rate_limiting_tests.cpp               |   4 +-
 21 files changed, 227 insertions(+), 191 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/include/mesos/master/allocator.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/master/allocator.hpp 
b/include/mesos/master/allocator.hpp
new file mode 100644
index 0000000..bb40b1c
--- /dev/null
+++ b/include/mesos/master/allocator.hpp
@@ -0,0 +1,130 @@
+/**
+ * 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_MASTER_ALLOCATOR_HPP__
+#define __MESOS_MASTER_ALLOCATOR_HPP__
+
+#include <string>
+#include <vector>
+
+// ONLY USEFUL AFTER RUNNING PROTOC.
+#include <mesos/master/allocator.pb.h>
+
+#include <mesos/resources.hpp>
+
+#include <stout/duration.hpp>
+#include <stout/hashmap.hpp>
+#include <stout/hashset.hpp>
+#include <stout/lambda.hpp>
+#include <stout/option.hpp>
+
+namespace mesos {
+namespace master {
+namespace allocator {
+
+// Basic model of an allocator: resources are allocated to a framework
+// in the form of offers. A framework can refuse some resources in
+// offers and run tasks in others. Allocated resources can have offer
+// operations applied to them in order for frameworks to alter the
+// resource metadata (e.g. creating persistent volumes). Resources can
+// be recovered from a framework when tasks finish/fail (or are lost
+// due to a slave failure) or when an offer is rescinded.
+//
+// This is the public API for resource allocators.
+// TODO(alexr): Document API calls.
+class Allocator
+{
+public:
+  Allocator() {}
+
+  virtual ~Allocator() {}
+
+  virtual void initialize(
+      const Duration& allocationInterval,
+      const lambda::function<
+          void(const FrameworkID&,
+               const hashmap<SlaveID, Resources>&)>& offerCallback,
+      const hashmap<std::string, internal::RoleInfo>& roles) = 0;
+
+  virtual void addFramework(
+      const FrameworkID& frameworkId,
+      const FrameworkInfo& frameworkInfo,
+      const hashmap<SlaveID, Resources>& used) = 0;
+
+  virtual void removeFramework(
+      const FrameworkID& frameworkId) = 0;
+
+  // Offers are sent only to activated frameworks.
+  virtual void activateFramework(
+      const FrameworkID& frameworkId) = 0;
+
+  virtual void deactivateFramework(
+      const FrameworkID& frameworkId) = 0;
+
+  // Note that the 'total' resources are passed explicitly because it
+  // includes resources that are dynamically "checkpointed" on the
+  // slave (e.g. persistent volumes, dynamic reservations, etc). The
+  // slaveInfo resources, on the other hand, correspond directly to
+  // the static --resources flag value on the slave.
+  virtual void addSlave(
+      const SlaveID& slaveId,
+      const SlaveInfo& slaveInfo,
+      const Resources& total,
+      const hashmap<FrameworkID, Resources>& used) = 0;
+
+  virtual void removeSlave(
+      const SlaveID& slaveId) = 0;
+
+  // Offers are sent only for activated slaves.
+  virtual void activateSlave(
+      const SlaveID& slaveId) = 0;
+
+  virtual void deactivateSlave(
+      const SlaveID& slaveId) = 0;
+
+  virtual void updateWhitelist(
+      const Option<hashset<std::string> >& whitelist) = 0;
+
+  virtual void requestResources(
+      const FrameworkID& frameworkId,
+      const std::vector<Request>& requests) = 0;
+
+  virtual void updateAllocation(
+      const FrameworkID& frameworkId,
+      const SlaveID& slaveId,
+      const std::vector<Offer::Operation>& operations) = 0;
+
+  // Informs the Allocator to recover resources that are considered
+  // used by the framework.
+  virtual void recoverResources(
+      const FrameworkID& frameworkId,
+      const SlaveID& slaveId,
+      const Resources& resources,
+      const Option<Filters>& filters) = 0;
+
+  // Whenever a framework that has filtered resources wants to revive
+  // offers for those resources the master invokes this callback.
+  virtual void reviveOffers(
+      const FrameworkID& frameworkId) = 0;
+};
+
+} // namespace allocator {
+} // namespace master {
+} // namespace mesos {
+
+#endif // __MESOS_MASTER_ALLOCATOR_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/include/mesos/master/allocator.proto
----------------------------------------------------------------------
diff --git a/include/mesos/master/allocator.proto 
b/include/mesos/master/allocator.proto
new file mode 100644
index 0000000..5566719
--- /dev/null
+++ b/include/mesos/master/allocator.proto
@@ -0,0 +1,27 @@
+/**
+ * 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.
+ */
+
+package mesos.internal;
+
+// Describes a role, which are used to group frameworks for allocation
+// decisions, depending on the allocation policy being used.
+// The weight field can be used to indicate forms of priority.
+message RoleInfo {
+  required string name = 1;
+  optional double weight = 2 [default = 1];
+}

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index d15a373..5751e96 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -140,6 +140,9 @@ endif
 
 MESOS_PROTO = $(top_srcdir)/include/mesos/mesos.proto
 
+ALLOCATOR_PROTO =                                                      \
+  $(top_srcdir)/include/mesos/master/allocator.proto
+
 AUTHENTICATION_PROTO =                                                 \
   $(top_srcdir)/include/mesos/authentication/authentication.proto
 
@@ -164,6 +167,8 @@ CXX_PROTOS =                                                
                \
   ../include/mesos/containerizer/containerizer.pb.h                    \
   fetcher/fetcher.pb.cc                                                        
\
   ../include/mesos/fetcher/fetcher.pb.h                                        
\
+  master/allocator.pb.cc                                               \
+  ../include/mesos/master/allocator.pb.h                               \
   module/module.pb.cc                                                  \
   ../include/mesos/module/module.pb.h                                  \
   scheduler/scheduler.pb.cc                                            \
@@ -226,6 +231,12 @@ fetcher/%.pb.cc ../include/mesos/fetcher/%.pb.h: 
$(FETCHER_PROTO)
        $(PROTOC) $(PROTOCFLAGS) --cpp_out=../include $^
        mv ../include/mesos/fetcher/*.pb.cc $(@D)
 
+master/%.pb.cc ../include/mesos/master/%.pb.h: $(ALLOCATOR_PROTO)
+       $(MKDIR_P) $(@D)
+       $(MKDIR_P) ../include/mesos/master
+       $(PROTOC) $(PROTOCFLAGS) --cpp_out=../include $^
+       mv ../include/mesos/master/*.pb.cc $(@D)
+
 module/%.pb.cc ../include/mesos/module/%.pb.h: $(MODULE_PROTO)
        $(MKDIR_P) $(@D)
        $(MKDIR_P) ../include/mesos/module
@@ -407,6 +418,14 @@ fetcher_HEADERS =                                          
        \
 
 nodist_fetcher_HEADERS = ../include/mesos/fetcher/fetcher.pb.h
 
+masterdir = $(pkgincludedir)/master
+
+master_HEADERS =                                                       \
+  $(top_srcdir)/include/mesos/master/allocator.hpp                     \
+  $(top_srcdir)/include/mesos/master/allocator.proto
+
+nodist_master_HEADERS = ../include/mesos/master/allocator.pb.h
+
 moduledir = $(pkgincludedir)/module
 
 module_HEADERS =                                                       \
@@ -526,7 +545,6 @@ libmesos_no_3rdparty_la_SOURCES +=                          
        \
        master/repairer.hpp                                             \
        master/registrar.hpp                                            \
        master/validation.hpp                                           \
-       master/allocator/allocator.hpp                                  \
        master/allocator/mesos/allocator.hpp                            \
        master/allocator/mesos/hierarchical.hpp                         \
        master/allocator/sorter/drf/sorter.hpp                          \
@@ -692,7 +710,8 @@ libmesos_no_3rdparty_la_LIBADD += libstate.la
 lib_LTLIBRARIES += libmesos.la
 
 # Include as part of the distribution.
-libmesos_la_SOURCES =                                                  \
+libmesos_la_SOURCES =                                                  \
+  $(ALLOCATOR_PROTO)                                                   \
   $(CONTAINERIZER_PROTO)                                               \
   $(FETCHER_PROTO)                                                     \
   $(MESOS_PROTO)                                                       \

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/local/local.cpp
----------------------------------------------------------------------
diff --git a/src/local/local.cpp b/src/local/local.cpp
index 289b9bc..f448912 100644
--- a/src/local/local.cpp
+++ b/src/local/local.cpp
@@ -22,6 +22,8 @@
 #include <string>
 #include <vector>
 
+#include <mesos/master/allocator.hpp>
+
 #include <mesos/module/anonymous.hpp>
 
 #include <process/limiter.hpp>
@@ -52,7 +54,6 @@
 #include "master/registrar.hpp"
 #include "master/repairer.hpp"
 
-#include "master/allocator/allocator.hpp"
 #include "master/allocator/mesos/hierarchical.hpp"
 #include "master/allocator/sorter/drf/sorter.hpp"
 
@@ -75,7 +76,8 @@ using memory::shared_ptr;
 using namespace mesos::internal;
 using namespace mesos::internal::log;
 
-using mesos::internal::master::allocator::Allocator;
+using mesos::master::allocator::Allocator;
+
 using mesos::internal::master::allocator::HierarchicalDRFAllocator;
 
 using mesos::internal::master::Master;

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/local/local.hpp
----------------------------------------------------------------------
diff --git a/src/local/local.hpp b/src/local/local.hpp
index 0aa50ef..6bb25f1 100644
--- a/src/local/local.hpp
+++ b/src/local/local.hpp
@@ -19,24 +19,18 @@
 #ifndef __MESOS_LOCAL_HPP__
 #define __MESOS_LOCAL_HPP__
 
+#include <mesos/master/allocator.hpp>
+
 #include <process/process.hpp>
 
 #include "local/flags.hpp"
 
+// Forward declarations.
 namespace mesos {
 namespace internal {
 
-// Forward declarations.
 namespace master {
-
 class Master;
-
-namespace allocator {
-
-class Allocator;
-
-} // namespace allocator {
-
 } // namespace master {
 
 class Configuration;
@@ -46,7 +40,7 @@ namespace local {
 // Launch a local cluster with the given flags.
 process::PID<master::Master> launch(
     const Flags& flags,
-    master::allocator::Allocator* _allocator = NULL);
+    mesos::master::allocator::Allocator* _allocator = NULL);
 
 void shutdown();
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/master/allocator/allocator.hpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/allocator.hpp 
b/src/master/allocator/allocator.hpp
deleted file mode 100644
index 38bc3e9..0000000
--- a/src/master/allocator/allocator.hpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * 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 __MASTER_ALLOCATOR_ALLOCATOR_HPP__
-#define __MASTER_ALLOCATOR_ALLOCATOR_HPP__
-
-#include <string>
-#include <vector>
-
-#include <mesos/resources.hpp>
-
-#include <stout/duration.hpp>
-#include <stout/hashmap.hpp>
-#include <stout/hashset.hpp>
-#include <stout/lambda.hpp>
-#include <stout/option.hpp>
-
-namespace mesos {
-namespace internal {
-namespace master {
-namespace allocator {
-
-// Basic model of an allocator: resources are allocated to a framework
-// in the form of offers. A framework can refuse some resources in
-// offers and run tasks in others. Allocated resources can have offer
-// operations applied to them in order for frameworks to alter the
-// resource metadata (e.g. creating persistent volumes). Resources can
-// be recovered from a framework when tasks finish/fail (or are lost
-// due to a slave failure) or when an offer is rescinded.
-//
-// This is the public API for resource allocators.
-// TODO(alexr): Document API calls.
-class Allocator
-{
-public:
-  Allocator() {}
-
-  virtual ~Allocator() {}
-
-  virtual void initialize(
-      const Duration& allocationInterval,
-      const lambda::function<
-          void(const FrameworkID&,
-               const hashmap<SlaveID, Resources>&)>& offerCallback,
-      const hashmap<std::string, RoleInfo>& roles) = 0;
-
-  virtual void addFramework(
-      const FrameworkID& frameworkId,
-      const FrameworkInfo& frameworkInfo,
-      const hashmap<SlaveID, Resources>& used) = 0;
-
-  virtual void removeFramework(
-      const FrameworkID& frameworkId) = 0;
-
-  // Offers are sent only to activated frameworks.
-  virtual void activateFramework(
-      const FrameworkID& frameworkId) = 0;
-
-  virtual void deactivateFramework(
-      const FrameworkID& frameworkId) = 0;
-
-  // Note that the 'total' resources are passed explicitly because it
-  // includes resources that are dynamically "checkpointed" on the
-  // slave (e.g. persistent volumes, dynamic reservations, etc). The
-  // slaveInfo resources, on the other hand, correspond directly to
-  // the static --resources flag value on the slave.
-  virtual void addSlave(
-      const SlaveID& slaveId,
-      const SlaveInfo& slaveInfo,
-      const Resources& total,
-      const hashmap<FrameworkID, Resources>& used) = 0;
-
-  virtual void removeSlave(
-      const SlaveID& slaveId) = 0;
-
-  // Offers are sent only for activated slaves.
-  virtual void activateSlave(
-      const SlaveID& slaveId) = 0;
-
-  virtual void deactivateSlave(
-      const SlaveID& slaveId) = 0;
-
-  virtual void updateWhitelist(
-      const Option<hashset<std::string> >& whitelist) = 0;
-
-  virtual void requestResources(
-      const FrameworkID& frameworkId,
-      const std::vector<Request>& requests) = 0;
-
-  virtual void updateAllocation(
-      const FrameworkID& frameworkId,
-      const SlaveID& slaveId,
-      const std::vector<Offer::Operation>& operations) = 0;
-
-  // Informs the Allocator to recover resources that are considered
-  // used by the framework.
-  virtual void recoverResources(
-      const FrameworkID& frameworkId,
-      const SlaveID& slaveId,
-      const Resources& resources,
-      const Option<Filters>& filters) = 0;
-
-  // Whenever a framework that has filtered resources wants to revive
-  // offers for those resources the master invokes this callback.
-  virtual void reviveOffers(
-      const FrameworkID& frameworkId) = 0;
-};
-
-} // namespace allocator {
-} // namespace master {
-} // namespace internal {
-} // namespace mesos {
-
-#endif // __MASTER_ALLOCATOR_ALLOCATOR_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/master/allocator/mesos/allocator.hpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/allocator.hpp 
b/src/master/allocator/mesos/allocator.hpp
index 5100aec..4089ac0 100644
--- a/src/master/allocator/mesos/allocator.hpp
+++ b/src/master/allocator/mesos/allocator.hpp
@@ -19,11 +19,11 @@
 #ifndef __MASTER_ALLOCATOR_MESOS_ALLOCATOR_HPP__
 #define __MASTER_ALLOCATOR_MESOS_ALLOCATOR_HPP__
 
+#include <mesos/master/allocator.hpp>
+
 #include <process/dispatch.hpp>
 #include <process/process.hpp>
 
-#include "master/allocator/allocator.hpp"
-
 namespace mesos {
 namespace internal {
 namespace master {
@@ -36,7 +36,7 @@ class MesosAllocatorProcess;
 // lifetime. We ensure the template parameter AllocatorProcess
 // implements MesosAllocatorProcess by storing a pointer to it.
 template <typename AllocatorProcess>
-class MesosAllocator : public Allocator
+class MesosAllocator : public mesos::master::allocator::Allocator
 {
 public:
   MesosAllocator();

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/master/main.cpp
----------------------------------------------------------------------
diff --git a/src/master/main.cpp b/src/master/main.cpp
index 7cce3a0..5ec1825 100644
--- a/src/master/main.cpp
+++ b/src/master/main.cpp
@@ -24,6 +24,8 @@
 
 #include <mesos/mesos.hpp>
 
+#include <mesos/master/allocator.hpp>
+
 #include <mesos/module/anonymous.hpp>
 
 #include <process/limiter.hpp>
@@ -59,7 +61,6 @@
 #include "master/registrar.hpp"
 #include "master/repairer.hpp"
 
-#include "master/allocator/allocator.hpp"
 #include "master/allocator/mesos/hierarchical.hpp"
 
 #include "module/manager.hpp"
@@ -199,7 +200,8 @@ int main(int argc, char** argv)
     LOG(INFO) << "Git SHA: " << build::GIT_SHA.get();
   }
 
-  allocator::Allocator* allocator = new allocator::HierarchicalDRFAllocator();
+  mesos::master::allocator::Allocator* allocator =
+    new allocator::HierarchicalDRFAllocator();
 
   state::Storage* storage = NULL;
   Log* log = NULL;

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 2c9187d..b726838 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -29,6 +29,8 @@
 
 #include <mesos/authentication/authenticator.hpp>
 
+#include <mesos/master/allocator.hpp>
+
 #include <mesos/module/authenticator.hpp>
 
 #include <process/check.hpp>
@@ -77,8 +79,6 @@
 #include "master/flags.hpp"
 #include "master/master.hpp"
 
-#include "master/allocator/allocator.hpp"
-
 #include "module/manager.hpp"
 
 #include "watcher/whitelist_watcher.hpp"
@@ -112,7 +112,7 @@ namespace mesos {
 namespace internal {
 namespace master {
 
-using allocator::Allocator;
+using mesos::master::allocator::Allocator;
 
 
 class SlaveObserver : public Process<SlaveObserver>

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/master/master.hpp
----------------------------------------------------------------------
diff --git a/src/master/master.hpp b/src/master/master.hpp
index c10e7c0..d21129b 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -32,6 +32,8 @@
 #include <mesos/scheduler.hpp>
 #include <mesos/type_utils.hpp>
 
+#include <mesos/master/allocator.hpp>
+
 #include <mesos/module/authenticator.hpp>
 
 #include <process/limiter.hpp>
@@ -81,11 +83,6 @@ class WhitelistWatcher;
 
 namespace master {
 
-// Forward declarations.
-namespace allocator {
-class Allocator;
-}
-
 class Repairer;
 class SlaveObserver;
 
@@ -98,7 +95,7 @@ struct Slave;
 class Master : public ProtobufProcess<Master>
 {
 public:
-  Master(allocator::Allocator* allocator,
+  Master(mesos::master::allocator::Allocator* allocator,
          Registrar* registrar,
          Repairer* repairer,
          Files* files,
@@ -538,7 +535,7 @@ private:
 
   Option<MasterInfo> leader; // Current leading master.
 
-  allocator::Allocator* allocator;
+  mesos::master::allocator::Allocator* allocator;
   WhitelistWatcher* whitelistWatcher;
   Registrar* registrar;
   Repairer* repairer;

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/messages/messages.proto
----------------------------------------------------------------------
diff --git a/src/messages/messages.proto b/src/messages/messages.proto
index 2d242dc..bdf474b 100644
--- a/src/messages/messages.proto
+++ b/src/messages/messages.proto
@@ -64,15 +64,6 @@ message Task {
 }
 
 
-// Describes a role, which are used to group frameworks for allocation
-// decisions, depending on the allocation policy being used.
-// The weight field can be used to indicate forms of priority.
-message RoleInfo {
-  required string name = 1;
-  optional double weight = 2 [default = 1];
-}
-
-
 // TODO(vinod): Create a new UUID message type.
 message StatusUpdate {
   required FrameworkID framework_id = 1;

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/tests/cluster.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cluster.hpp b/src/tests/cluster.hpp
index a56b654..fc4d5d1 100644
--- a/src/tests/cluster.hpp
+++ b/src/tests/cluster.hpp
@@ -25,6 +25,8 @@
 
 #include <mesos/mesos.hpp>
 
+#include <mesos/master/allocator.hpp>
+
 #include <process/clock.hpp>
 #include <process/future.hpp>
 #include <process/gmock.hpp>
@@ -64,7 +66,6 @@
 #include "master/registrar.hpp"
 #include "master/repairer.hpp"
 
-#include "master/allocator/allocator.hpp"
 #include "master/allocator/mesos/hierarchical.hpp"
 
 #include "slave/flags.hpp"
@@ -105,7 +106,7 @@ public:
     // Start a new master with the provided flags and injections.
     Try<process::PID<master::Master> > start(
         const master::Flags& flags = master::Flags(),
-        const Option<master::allocator::Allocator*>& allocator = None(),
+        const Option<mesos::master::allocator::Allocator*>& allocator = None(),
         const Option<Authorizer*>& authorizer = None(),
         const Option<memory::shared_ptr<process::RateLimiter> >&
           slaveRemovalLimiter = None());
@@ -129,7 +130,7 @@ public:
     {
       Master() : allocator(NULL), createdAllocator(false), master(NULL) {}
 
-      master::allocator::Allocator* allocator;
+      mesos::master::allocator::Allocator* allocator;
       bool createdAllocator; // Whether we own the allocator.
 
       process::Owned<log::Log> log;
@@ -254,7 +255,7 @@ inline void Cluster::Masters::shutdown()
 
 inline Try<process::PID<master::Master> > Cluster::Masters::start(
     const master::Flags& flags,
-    const Option<master::allocator::Allocator*>& allocator,
+    const Option<mesos::master::allocator::Allocator*>& allocator,
     const Option<Authorizer*>& authorizer,
     const Option<memory::shared_ptr<process::RateLimiter>>& 
slaveRemovalLimiter)
 {

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/tests/fault_tolerance_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/fault_tolerance_tests.cpp 
b/src/tests/fault_tolerance_tests.cpp
index a637c32..3a27d82 100644
--- a/src/tests/fault_tolerance_tests.cpp
+++ b/src/tests/fault_tolerance_tests.cpp
@@ -26,6 +26,8 @@
 
 #include <mesos/authentication/authentication.hpp>
 
+#include <mesos/master/allocator.hpp>
+
 #include <process/future.hpp>
 #include <process/gmock.hpp>
 #include <process/http.hpp>
@@ -41,8 +43,6 @@
 
 #include "master/master.hpp"
 
-#include "master/allocator/allocator.hpp"
-
 #include "sched/constants.hpp"
 
 #include "slave/constants.hpp"

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/tests/hierarchical_allocator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/hierarchical_allocator_tests.cpp 
b/src/tests/hierarchical_allocator_tests.cpp
index cf822a2..ca93bd1 100644
--- a/src/tests/hierarchical_allocator_tests.cpp
+++ b/src/tests/hierarchical_allocator_tests.cpp
@@ -22,6 +22,8 @@
 #include <queue>
 #include <vector>
 
+#include <mesos/master/allocator.hpp>
+
 #include <process/clock.hpp>
 #include <process/future.hpp>
 #include <process/gtest.hpp>
@@ -36,13 +38,12 @@
 #include "master/constants.hpp"
 #include "master/flags.hpp"
 
-#include "master/allocator/allocator.hpp"
 #include "master/allocator/mesos/hierarchical.hpp"
 
 using mesos::internal::master::MIN_CPUS;
 using mesos::internal::master::MIN_MEM;
 
-using mesos::internal::master::allocator::Allocator;
+using mesos::master::allocator::Allocator;
 using mesos::internal::master::allocator::HierarchicalDRFAllocator;
 
 using process::Clock;

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/tests/master_allocator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_allocator_tests.cpp 
b/src/tests/master_allocator_tests.cpp
index 03a1bb8..f29e90e 100644
--- a/src/tests/master_allocator_tests.cpp
+++ b/src/tests/master_allocator_tests.cpp
@@ -25,6 +25,8 @@
 #include <mesos/executor.hpp>
 #include <mesos/scheduler.hpp>
 
+#include <mesos/master/allocator.hpp>
+
 #include <process/clock.hpp>
 #include <process/future.hpp>
 #include <process/gmock.hpp>
@@ -37,13 +39,12 @@
 #include "master/detector.hpp"
 #include "master/master.hpp"
 
-#include "master/allocator/allocator.hpp"
 #include "master/allocator/mesos/hierarchical.hpp"
 
 #include "tests/containerizer.hpp"
 #include "tests/mesos.hpp"
 
-using mesos::internal::master::allocator::Allocator;
+using mesos::master::allocator::Allocator;
 using mesos::internal::master::allocator::HierarchicalDRFAllocator;
 
 using mesos::internal::master::Master;

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/tests/master_authorization_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_authorization_tests.cpp 
b/src/tests/master_authorization_tests.cpp
index ac79303..5633c82 100644
--- a/src/tests/master_authorization_tests.cpp
+++ b/src/tests/master_authorization_tests.cpp
@@ -23,6 +23,8 @@
 #include <mesos/executor.hpp>
 #include <mesos/scheduler.hpp>
 
+#include <mesos/master/allocator.hpp>
+
 #include <process/clock.hpp>
 #include <process/future.hpp>
 #include <process/pid.hpp>
@@ -33,8 +35,6 @@
 
 #include "master/master.hpp"
 
-#include "master/allocator/allocator.hpp"
-
 #include "messages/messages.hpp"
 
 #include "slave/slave.hpp"

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/tests/master_slave_reconciliation_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_slave_reconciliation_tests.cpp 
b/src/tests/master_slave_reconciliation_tests.cpp
index e60f601..ded3f52 100644
--- a/src/tests/master_slave_reconciliation_tests.cpp
+++ b/src/tests/master_slave_reconciliation_tests.cpp
@@ -24,6 +24,8 @@
 #include <mesos/mesos.hpp>
 #include <mesos/scheduler.hpp>
 
+#include <mesos/master/allocator.hpp>
+
 #include <process/future.hpp>
 #include <process/gmock.hpp>
 #include <process/pid.hpp>
@@ -34,8 +36,6 @@
 
 #include "master/master.hpp"
 
-#include "master/allocator/allocator.hpp"
-
 #include "slave/slave.hpp"
 
 #include "tests/containerizer.hpp"

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/tests/master_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index 32b1e9b..8405105 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -26,6 +26,8 @@
 #include <mesos/executor.hpp>
 #include <mesos/scheduler.hpp>
 
+#include <mesos/master/allocator.hpp>
+
 #include <process/clock.hpp>
 #include <process/future.hpp>
 #include <process/gmock.hpp>
@@ -48,8 +50,6 @@
 #include "master/flags.hpp"
 #include "master/master.hpp"
 
-#include "master/allocator/allocator.hpp"
-
 #include "slave/constants.hpp"
 #include "slave/gc.hpp"
 #include "slave/flags.hpp"

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/tests/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp
index 42a4015..1dde4fe 100644
--- a/src/tests/mesos.cpp
+++ b/src/tests/mesos.cpp
@@ -189,7 +189,7 @@ Try<PID<master::Master> > MesosTest::StartMaster(
 
 
 Try<PID<master::Master> > MesosTest::StartMaster(
-    master::allocator::Allocator* allocator,
+    mesos::master::allocator::Allocator* allocator,
     const Option<master::Flags>& flags)
 {
   return cluster.masters.start(

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index f8c9604..61eaa28 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -27,6 +27,8 @@
 #include <mesos/executor.hpp>
 #include <mesos/scheduler.hpp>
 
+#include <mesos/master/allocator.hpp>
+
 #include <process/future.hpp>
 #include <process/gmock.hpp>
 #include <process/gtest.hpp>
@@ -51,8 +53,6 @@
 #include "master/detector.hpp"
 #include "master/master.hpp"
 
-#include "master/allocator/allocator.hpp"
-
 #include "slave/slave.hpp"
 
 #include "slave/containerizer/containerizer.hpp"
@@ -99,7 +99,7 @@ protected:
 
   // Starts a master with the specified allocator process and flags.
   virtual Try<process::PID<master::Master> > StartMaster(
-      master::allocator::Allocator* allocator,
+      mesos::master::allocator::Allocator* allocator,
       const Option<master::Flags>& flags = None());
 
   // Starts a master with the specified authorizer and flags.
@@ -757,8 +757,8 @@ public:
 };
 
 
-template <typename T = master::allocator::Allocator>
-class TestAllocator : public master::allocator::Allocator
+template <typename T = mesos::master::allocator::Allocator>
+class TestAllocator : public mesos::master::allocator::Allocator
 {
 public:
   TestAllocator()

http://git-wip-us.apache.org/repos/asf/mesos/blob/f1fc3d76/src/tests/rate_limiting_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/rate_limiting_tests.cpp 
b/src/tests/rate_limiting_tests.cpp
index d5c00b8..49d907b 100644
--- a/src/tests/rate_limiting_tests.cpp
+++ b/src/tests/rate_limiting_tests.cpp
@@ -18,6 +18,8 @@
 
 #include <gmock/gmock.h>
 
+#include <mesos/master/allocator.hpp>
+
 #include <process/clock.hpp>
 #include <process/future.hpp>
 #include <process/gmock.hpp>
@@ -28,8 +30,6 @@
 #include "master/flags.hpp"
 #include "master/master.hpp"
 
-#include "master/allocator/allocator.hpp"
-
 #include "tests/mesos.hpp"
 #include "tests/utils.hpp"
 

Reply via email to