Moved RoleInfo to mesos.master namespace. Since the Allocator is a public interface now, there is no reason to keep RoleInfo in mesos.internal. It is ok to change the package because RoleInfo is used solely by Master and Allocator, hence there is no external communication affected.
Review: https://reviews.apache.org/r/33356 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/aabebb14 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/aabebb14 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/aabebb14 Branch: refs/heads/master Commit: aabebb14c22492552c77ed471ad56a51c87d4ee1 Parents: f1fc3d7 Author: Alexander Rukletsov <[email protected]> Authored: Tue Apr 21 12:10:27 2015 -0700 Committer: Niklas Q. Nielsen <[email protected]> Committed: Tue Apr 21 12:10:30 2015 -0700 ---------------------------------------------------------------------- include/mesos/master/allocator.hpp | 2 +- include/mesos/master/allocator.proto | 2 +- src/master/allocator/mesos/allocator.hpp | 6 +++--- src/master/allocator/mesos/hierarchical.hpp | 9 +++++---- src/master/master.cpp | 1 + src/master/master.hpp | 4 ++-- src/tests/hierarchical_allocator_tests.cpp | 1 + src/tests/mesos.hpp | 2 +- 8 files changed, 15 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/aabebb14/include/mesos/master/allocator.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/master/allocator.hpp b/include/mesos/master/allocator.hpp index bb40b1c..e821bf3 100644 --- a/include/mesos/master/allocator.hpp +++ b/include/mesos/master/allocator.hpp @@ -59,7 +59,7 @@ public: const lambda::function< void(const FrameworkID&, const hashmap<SlaveID, Resources>&)>& offerCallback, - const hashmap<std::string, internal::RoleInfo>& roles) = 0; + const hashmap<std::string, RoleInfo>& roles) = 0; virtual void addFramework( const FrameworkID& frameworkId, http://git-wip-us.apache.org/repos/asf/mesos/blob/aabebb14/include/mesos/master/allocator.proto ---------------------------------------------------------------------- diff --git a/include/mesos/master/allocator.proto b/include/mesos/master/allocator.proto index 5566719..c32b88e 100644 --- a/include/mesos/master/allocator.proto +++ b/include/mesos/master/allocator.proto @@ -16,7 +16,7 @@ * limitations under the License. */ -package mesos.internal; +package mesos.master; // Describes a role, which are used to group frameworks for allocation // decisions, depending on the allocation policy being used. http://git-wip-us.apache.org/repos/asf/mesos/blob/aabebb14/src/master/allocator/mesos/allocator.hpp ---------------------------------------------------------------------- diff --git a/src/master/allocator/mesos/allocator.hpp b/src/master/allocator/mesos/allocator.hpp index 4089ac0..5360d0a 100644 --- a/src/master/allocator/mesos/allocator.hpp +++ b/src/master/allocator/mesos/allocator.hpp @@ -48,7 +48,7 @@ public: const lambda::function< void(const FrameworkID&, const hashmap<SlaveID, Resources>&)>& offerCallback, - const hashmap<std::string, RoleInfo>& roles); + const hashmap<std::string, mesos::master::RoleInfo>& roles); void addFramework( const FrameworkID& frameworkId, @@ -125,7 +125,7 @@ public: const lambda::function< void(const FrameworkID&, const hashmap<SlaveID, Resources>&)>& offerCallback, - const hashmap<std::string, RoleInfo>& roles) = 0; + const hashmap<std::string, mesos::master::RoleInfo>& roles) = 0; virtual void addFramework( const FrameworkID& frameworkId, @@ -202,7 +202,7 @@ inline void MesosAllocator<AllocatorProcess>::initialize( const lambda::function< void(const FrameworkID&, const hashmap<SlaveID, Resources>&)>& offerCallback, - const hashmap<std::string, RoleInfo>& roles) + const hashmap<std::string, mesos::master::RoleInfo>& roles) { process::dispatch( process, http://git-wip-us.apache.org/repos/asf/mesos/blob/aabebb14/src/master/allocator/mesos/hierarchical.hpp ---------------------------------------------------------------------- diff --git a/src/master/allocator/mesos/hierarchical.hpp b/src/master/allocator/mesos/hierarchical.hpp index 95b7905..09adced 100644 --- a/src/master/allocator/mesos/hierarchical.hpp +++ b/src/master/allocator/mesos/hierarchical.hpp @@ -76,7 +76,7 @@ public: const lambda::function< void(const FrameworkID&, const hashmap<SlaveID, Resources>&)>& offerCallback, - const hashmap<std::string, RoleInfo>& roles); + const hashmap<std::string, mesos::master::RoleInfo>& roles); void addFramework( const FrameworkID& frameworkId, @@ -191,7 +191,7 @@ protected: hashmap<SlaveID, Slave> slaves; - hashmap<std::string, RoleInfo> roles; + hashmap<std::string, mesos::master::RoleInfo> roles; // Slaves to send offers for. Option<hashset<std::string> > whitelist; @@ -267,7 +267,7 @@ HierarchicalAllocatorProcess<RoleSorter, FrameworkSorter>::initialize( const lambda::function< void(const FrameworkID&, const hashmap<SlaveID, Resources>&)>& _offerCallback, - const hashmap<std::string, RoleInfo>& _roles) + const hashmap<std::string, mesos::master::RoleInfo>& _roles) { allocationInterval = _allocationInterval; offerCallback = _offerCallback; @@ -275,7 +275,8 @@ HierarchicalAllocatorProcess<RoleSorter, FrameworkSorter>::initialize( initialized = true; roleSorter = new RoleSorter(); - foreachpair (const std::string& name, const RoleInfo& roleInfo, roles) { + foreachpair ( + const std::string& name, const mesos::master::RoleInfo& roleInfo, roles) { roleSorter->add(name, roleInfo.weight()); frameworkSorters[name] = new FrameworkSorter(); } http://git-wip-us.apache.org/repos/asf/mesos/blob/aabebb14/src/master/master.cpp ---------------------------------------------------------------------- diff --git a/src/master/master.cpp b/src/master/master.cpp index b726838..f3462d1 100644 --- a/src/master/master.cpp +++ b/src/master/master.cpp @@ -112,6 +112,7 @@ namespace mesos { namespace internal { namespace master { +using mesos::master::RoleInfo; using mesos::master::allocator::Allocator; http://git-wip-us.apache.org/repos/asf/mesos/blob/aabebb14/src/master/master.hpp ---------------------------------------------------------------------- diff --git a/src/master/master.hpp b/src/master/master.hpp index d21129b..550d2c5 100644 --- a/src/master/master.hpp +++ b/src/master/master.hpp @@ -1251,7 +1251,7 @@ inline std::ostream& operator << ( // Information about an active role. struct Role { - explicit Role(const RoleInfo& _info) + explicit Role(const mesos::master::RoleInfo& _info) : info(_info) {} void addFramework(Framework* framework) @@ -1275,7 +1275,7 @@ struct Role return resources; } - RoleInfo info; + mesos::master::RoleInfo info; hashmap<FrameworkID, Framework*> frameworks; }; http://git-wip-us.apache.org/repos/asf/mesos/blob/aabebb14/src/tests/hierarchical_allocator_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/hierarchical_allocator_tests.cpp b/src/tests/hierarchical_allocator_tests.cpp index ca93bd1..e25b99f 100644 --- a/src/tests/hierarchical_allocator_tests.cpp +++ b/src/tests/hierarchical_allocator_tests.cpp @@ -44,6 +44,7 @@ using mesos::internal::master::MIN_CPUS; using mesos::internal::master::MIN_MEM; using mesos::master::allocator::Allocator; +using mesos::master::RoleInfo; using mesos::internal::master::allocator::HierarchicalDRFAllocator; using process::Clock; http://git-wip-us.apache.org/repos/asf/mesos/blob/aabebb14/src/tests/mesos.hpp ---------------------------------------------------------------------- diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp index 61eaa28..8a53430 100644 --- a/src/tests/mesos.hpp +++ b/src/tests/mesos.hpp @@ -850,7 +850,7 @@ public: const lambda::function< void(const FrameworkID&, const hashmap<SlaveID, Resources>&)>&, - const hashmap<std::string, RoleInfo>&)); + const hashmap<std::string, mesos::master::RoleInfo>&)); MOCK_METHOD3(addFramework, void( const FrameworkID&,
