Repository: mesos Updated Branches: refs/heads/master 3a51e7e92 -> ca5642cf0
Updated a few functions in the master to be declared `const`. Review: https://reviews.apache.org/r/57105 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ca5642cf Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ca5642cf Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ca5642cf Branch: refs/heads/master Commit: ca5642cf0986507884a3a94b6c500e2c48e81121 Parents: 41219c0 Author: Michael Park <[email protected]> Authored: Mon Feb 27 10:40:58 2017 -0800 Committer: Michael Park <[email protected]> Committed: Wed Mar 1 14:16:15 2017 -0800 ---------------------------------------------------------------------- src/master/master.cpp | 19 ++++++++++--------- src/master/master.hpp | 8 ++++---- 2 files changed, 14 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/ca5642cf/src/master/master.cpp ---------------------------------------------------------------------- diff --git a/src/master/master.cpp b/src/master/master.cpp index ae36bf4..2232cb7 100644 --- a/src/master/master.cpp +++ b/src/master/master.cpp @@ -3306,7 +3306,7 @@ void Master::suppress( } -bool Master::isWhitelistedRole(const string& name) +bool Master::isWhitelistedRole(const string& name) const { if (roleWhitelist.isNone()) { return true; @@ -8624,26 +8624,27 @@ bool Master::isCompletedFramework(const FrameworkID& frameworkId) // TODO(bmahler): Consider killing this. -Framework* Master::getFramework(const FrameworkID& frameworkId) +Framework* Master::getFramework(const FrameworkID& frameworkId) const { return frameworks.registered.contains(frameworkId) - ? frameworks.registered[frameworkId] - : nullptr; + ? frameworks.registered.at(frameworkId) + : nullptr; } // TODO(bmahler): Consider killing this. -Offer* Master::getOffer(const OfferID& offerId) +Offer* Master::getOffer(const OfferID& offerId) const { - return offers.contains(offerId) ? offers[offerId] : nullptr; + return offers.contains(offerId) ? offers.at(offerId) : nullptr; } // TODO(bmahler): Consider killing this. -InverseOffer* Master::getInverseOffer(const OfferID& inverseOfferId) +InverseOffer* Master::getInverseOffer(const OfferID& inverseOfferId) const { - return inverseOffers.contains(inverseOfferId) ? - inverseOffers[inverseOfferId] : nullptr; + return inverseOffers.contains(inverseOfferId) + ? inverseOffers.at(inverseOfferId) + : nullptr; } http://git-wip-us.apache.org/repos/asf/mesos/blob/ca5642cf/src/master/master.hpp ---------------------------------------------------------------------- diff --git a/src/master/master.hpp b/src/master/master.hpp index 764adb1..81320e0 100644 --- a/src/master/master.hpp +++ b/src/master/master.hpp @@ -793,9 +793,9 @@ protected: bool isCompletedFramework(const FrameworkID& frameworkId); - Framework* getFramework(const FrameworkID& frameworkId); - Offer* getOffer(const OfferID& offerId); - InverseOffer* getInverseOffer(const OfferID& inverseOfferId); + Framework* getFramework(const FrameworkID& frameworkId) const; + Offer* getOffer(const OfferID& offerId) const; + InverseOffer* getInverseOffer(const OfferID& inverseOfferId) const; FrameworkID newFrameworkId(); OfferID newOfferId(); @@ -940,7 +940,7 @@ private: * role whitelist. When using implicit roles, any role is allowed * (and access control is done via ACLs). */ - bool isWhitelistedRole(const std::string& name); + bool isWhitelistedRole(const std::string& name) const; /** * Indicates whether a task in the given state can safely be removed
