You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2017/03/01 22:16:35 UTC
[1/2] mesos git commit: Updated a few functions in the master to be
declared `const`.
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 <mp...@apache.org>
Authored: Mon Feb 27 10:40:58 2017 -0800
Committer: Michael Park <mp...@apache.org>
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
[2/2] mesos git commit: Updated a few functions in the agent to be
declared `const`.
Posted by mp...@apache.org.
Updated a few functions in the agent to be declared `const`.
Review: https://reviews.apache.org/r/57104
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/41219c07
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/41219c07
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/41219c07
Branch: refs/heads/master
Commit: 41219c071b62ee0ee7555c5eb770b3d98c1c0984
Parents: 3a51e7e
Author: Michael Park <mp...@apache.org>
Authored: Sun Feb 12 16:59:45 2017 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Wed Mar 1 14:16:15 2017 -0800
----------------------------------------------------------------------
src/slave/slave.cpp | 14 +++++++-------
src/slave/slave.hpp | 10 +++++-----
2 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/41219c07/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 892ce19..6ae9458 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -4397,10 +4397,10 @@ void Slave::exited(const UPID& pid)
}
-Framework* Slave::getFramework(const FrameworkID& frameworkId)
+Framework* Slave::getFramework(const FrameworkID& frameworkId) const
{
if (frameworks.count(frameworkId) > 0) {
- return frameworks[frameworkId];
+ return frameworks.at(frameworkId);
}
return nullptr;
@@ -4409,7 +4409,7 @@ Framework* Slave::getFramework(const FrameworkID& frameworkId)
Executor* Slave::getExecutor(
const FrameworkID& frameworkId,
- const ExecutorID& executorId)
+ const ExecutorID& executorId) const
{
Framework* framework = getFramework(frameworkId);
if (framework != nullptr) {
@@ -4422,7 +4422,7 @@ Executor* Slave::getExecutor(
ExecutorInfo Slave::getExecutorInfo(
const FrameworkInfo& frameworkInfo,
- const TaskInfo& task)
+ const TaskInfo& task) const
{
CHECK_NE(task.has_executor(), task.has_command())
<< "Task " << task.task_id()
@@ -6603,17 +6603,17 @@ void Framework::destroyExecutor(const ExecutorID& executorId)
}
-Executor* Framework::getExecutor(const ExecutorID& executorId)
+Executor* Framework::getExecutor(const ExecutorID& executorId) const
{
if (executors.contains(executorId)) {
- return executors[executorId];
+ return executors.at(executorId);
}
return nullptr;
}
-Executor* Framework::getExecutor(const TaskID& taskId)
+Executor* Framework::getExecutor(const TaskID& taskId) const
{
foreachvalue (Executor* executor, executors) {
if (executor->queuedTasks.contains(taskId) ||
http://git-wip-us.apache.org/repos/asf/mesos/blob/41219c07/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index 3b0aea4..449971b 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -361,11 +361,11 @@ public:
void authenticate();
// Helper routines to lookup a framework/executor.
- Framework* getFramework(const FrameworkID& frameworkId);
+ Framework* getFramework(const FrameworkID& frameworkId) const;
Executor* getExecutor(
const FrameworkID& frameworkId,
- const ExecutorID& executorId);
+ const ExecutorID& executorId) const;
Executor* getExecutor(const ContainerID& containerId) const;
@@ -373,7 +373,7 @@ public:
// constructing one if the task has a CommandInfo).
ExecutorInfo getExecutorInfo(
const FrameworkInfo& frameworkInfo,
- const TaskInfo& task);
+ const TaskInfo& task) const;
// Shuts down the executor if it did not register yet.
void registerExecutorTimeout(
@@ -1047,8 +1047,8 @@ struct Framework
const ExecutorInfo& executorInfo,
const Option<TaskInfo>& taskInfo);
void destroyExecutor(const ExecutorID& executorId);
- Executor* getExecutor(const ExecutorID& executorId);
- Executor* getExecutor(const TaskID& taskId);
+ Executor* getExecutor(const ExecutorID& executorId) const;
+ Executor* getExecutor(const TaskID& taskId) const;
void recoverExecutor(const state::ExecutorState& state);
void checkpointFramework() const;