Repository: mesos Updated Branches: refs/heads/master 01ee1e504 -> da607079b
Removed Master::Flags dependency from Allocator. On the way to moving allocator to public includes we need to remove the dependency to internal Master::Flags type. Review: https://reviews.apache.org/r/31775 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/97dce737 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/97dce737 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/97dce737 Branch: refs/heads/master Commit: 97dce737c0ea8822e37f6eb13cc195039f77c623 Parents: 01ee1e5 Author: Alexander Rukletsov <[email protected]> Authored: Tue Apr 21 12:09:09 2015 -0700 Committer: Niklas Q. Nielsen <[email protected]> Committed: Tue Apr 21 12:09:11 2015 -0700 ---------------------------------------------------------------------- src/master/allocator/allocator.hpp | 7 ++----- src/master/allocator/mesos/allocator.hpp | 8 ++++---- src/master/allocator/mesos/hierarchical.hpp | 12 ++++++------ src/master/master.cpp | 2 +- src/tests/hierarchical_allocator_tests.cpp | 2 +- src/tests/mesos.hpp | 2 +- 6 files changed, 15 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/97dce737/src/master/allocator/allocator.hpp ---------------------------------------------------------------------- diff --git a/src/master/allocator/allocator.hpp b/src/master/allocator/allocator.hpp index 5e3e613..38bc3e9 100644 --- a/src/master/allocator/allocator.hpp +++ b/src/master/allocator/allocator.hpp @@ -24,18 +24,15 @@ #include <mesos/resources.hpp> +#include <stout/duration.hpp> #include <stout/hashmap.hpp> #include <stout/hashset.hpp> #include <stout/lambda.hpp> #include <stout/option.hpp> -#include "master/flags.hpp" -#include "messages/messages.hpp" - namespace mesos { namespace internal { namespace master { - namespace allocator { // Basic model of an allocator: resources are allocated to a framework @@ -56,7 +53,7 @@ public: virtual ~Allocator() {} virtual void initialize( - const Flags& flags, + const Duration& allocationInterval, const lambda::function< void(const FrameworkID&, const hashmap<SlaveID, Resources>&)>& offerCallback, http://git-wip-us.apache.org/repos/asf/mesos/blob/97dce737/src/master/allocator/mesos/allocator.hpp ---------------------------------------------------------------------- diff --git a/src/master/allocator/mesos/allocator.hpp b/src/master/allocator/mesos/allocator.hpp index af27a9b..5100aec 100644 --- a/src/master/allocator/mesos/allocator.hpp +++ b/src/master/allocator/mesos/allocator.hpp @@ -44,7 +44,7 @@ public: ~MesosAllocator(); void initialize( - const Flags& flags, + const Duration& allocationInterval, const lambda::function< void(const FrameworkID&, const hashmap<SlaveID, Resources>&)>& offerCallback, @@ -121,7 +121,7 @@ public: using process::ProcessBase::initialize; virtual void initialize( - const Flags& flags, + const Duration& allocationInterval, const lambda::function< void(const FrameworkID&, const hashmap<SlaveID, Resources>&)>& offerCallback, @@ -198,7 +198,7 @@ MesosAllocator<AllocatorProcess>::~MesosAllocator() template <typename AllocatorProcess> inline void MesosAllocator<AllocatorProcess>::initialize( - const Flags& flags, + const Duration& allocationInterval, const lambda::function< void(const FrameworkID&, const hashmap<SlaveID, Resources>&)>& offerCallback, @@ -207,7 +207,7 @@ inline void MesosAllocator<AllocatorProcess>::initialize( process::dispatch( process, &MesosAllocatorProcess::initialize, - flags, + allocationInterval, offerCallback, roles); } http://git-wip-us.apache.org/repos/asf/mesos/blob/97dce737/src/master/allocator/mesos/hierarchical.hpp ---------------------------------------------------------------------- diff --git a/src/master/allocator/mesos/hierarchical.hpp b/src/master/allocator/mesos/hierarchical.hpp index 90ac197..95b7905 100644 --- a/src/master/allocator/mesos/hierarchical.hpp +++ b/src/master/allocator/mesos/hierarchical.hpp @@ -72,7 +72,7 @@ public: process::PID<HierarchicalAllocatorProcess> self(); void initialize( - const Flags& flags, + const Duration& allocationInterval, const lambda::function< void(const FrameworkID&, const hashmap<SlaveID, Resources>&)>& offerCallback, @@ -162,7 +162,7 @@ protected: bool initialized; - Flags flags; + Duration allocationInterval; lambda::function< void(const FrameworkID&, @@ -263,13 +263,13 @@ HierarchicalAllocatorProcess<RoleSorter, FrameworkSorter>::self() template <class RoleSorter, class FrameworkSorter> void HierarchicalAllocatorProcess<RoleSorter, FrameworkSorter>::initialize( - const Flags& _flags, + const Duration& _allocationInterval, const lambda::function< void(const FrameworkID&, const hashmap<SlaveID, Resources>&)>& _offerCallback, const hashmap<std::string, RoleInfo>& _roles) { - flags = _flags; + allocationInterval = _allocationInterval; offerCallback = _offerCallback; roles = _roles; initialized = true; @@ -286,7 +286,7 @@ HierarchicalAllocatorProcess<RoleSorter, FrameworkSorter>::initialize( VLOG(1) << "Initialized hierarchical allocator process"; - delay(flags.allocation_interval, self(), &Self::batch); + delay(allocationInterval, self(), &Self::batch); } @@ -713,7 +713,7 @@ void HierarchicalAllocatorProcess<RoleSorter, FrameworkSorter>::batch() { allocate(); - delay(flags.allocation_interval, self(), &Self::batch); + delay(allocationInterval, self(), &Self::batch); } http://git-wip-us.apache.org/repos/asf/mesos/blob/97dce737/src/master/master.cpp ---------------------------------------------------------------------- diff --git a/src/master/master.cpp b/src/master/master.cpp index b1093bb..2c9187d 100644 --- a/src/master/master.cpp +++ b/src/master/master.cpp @@ -600,7 +600,7 @@ void Master::initialize() // Initialize the allocator. allocator->initialize( - flags, + flags.allocation_interval, defer(self(), &Master::offer, lambda::_1, lambda::_2), roleInfos); http://git-wip-us.apache.org/repos/asf/mesos/blob/97dce737/src/tests/hierarchical_allocator_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/hierarchical_allocator_tests.cpp b/src/tests/hierarchical_allocator_tests.cpp index 0b564a7..cf822a2 100644 --- a/src/tests/hierarchical_allocator_tests.cpp +++ b/src/tests/hierarchical_allocator_tests.cpp @@ -95,7 +95,7 @@ protected: } allocator->initialize( - flags, + flags.allocation_interval, lambda::bind(&put, &queue, lambda::_1, lambda::_2), roles); } http://git-wip-us.apache.org/repos/asf/mesos/blob/97dce737/src/tests/mesos.hpp ---------------------------------------------------------------------- diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp index 4edb33b..f8c9604 100644 --- a/src/tests/mesos.hpp +++ b/src/tests/mesos.hpp @@ -846,7 +846,7 @@ public: ~TestAllocator() {} MOCK_METHOD3(initialize, void( - const master::Flags&, + const Duration&, const lambda::function< void(const FrameworkID&, const hashmap<SlaveID, Resources>&)>&,
