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:36 UTC

[2/2] mesos git commit: Updated a few functions in the agent to be declared `const`.

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;