You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2016/08/16 00:38:55 UTC

[6/6] mesos git commit: Replaced a static function for isolator prepare with lambda.

Replaced a static function for isolator prepare with lambda.

Review: https://reviews.apache.org/r/51114


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5c529fa5
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5c529fa5
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5c529fa5

Branch: refs/heads/master
Commit: 5c529fa5f17221001924713c9300ceebbfe7cfd5
Parents: 6bedbb3
Author: Jie Yu <yu...@gmail.com>
Authored: Mon Aug 15 15:52:26 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Aug 15 17:38:44 2016 -0700

----------------------------------------------------------------------
 src/slave/containerizer/mesos/containerizer.cpp | 33 +++++---------------
 1 file changed, 7 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5c529fa5/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index 31125a4..6df0141 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -970,27 +970,6 @@ Future<bool> MesosContainerizerProcess::_launch(
 }
 
 
-static list<Option<ContainerLaunchInfo>> accumulate(
-    list<Option<ContainerLaunchInfo>> l,
-    const Option<ContainerLaunchInfo>& e)
-{
-  l.push_back(e);
-  return l;
-}
-
-
-static Future<list<Option<ContainerLaunchInfo>>> _prepare(
-    const Owned<Isolator>& isolator,
-    const ContainerID& containerId,
-    const ContainerConfig& containerConfig,
-    const list<Option<ContainerLaunchInfo>> launchInfos)
-{
-  // Propagate any failure.
-  return isolator->prepare(containerId, containerConfig)
-    .then(lambda::bind(&accumulate, launchInfos, lambda::_1));
-}
-
-
 Future<list<Option<ContainerLaunchInfo>>> MesosContainerizerProcess::prepare(
     const ContainerID& containerId,
     const Option<TaskInfo>& taskInfo,
@@ -1060,11 +1039,13 @@ Future<list<Option<ContainerLaunchInfo>>> MesosContainerizerProcess::prepare(
 
   foreach (const Owned<Isolator>& isolator, isolators) {
     // Chain together preparing each isolator.
-    f = f.then(lambda::bind(&_prepare,
-                            isolator,
-                            containerId,
-                            containerConfig,
-                            lambda::_1));
+    f = f.then([=](list<Option<ContainerLaunchInfo>> launchInfos) {
+      return isolator->prepare(containerId, containerConfig)
+        .then([=](const Option<ContainerLaunchInfo>& launchInfo) mutable {
+          launchInfos.push_back(launchInfo);
+          return launchInfos;
+        });
+      });
   }
 
   containers_[containerId]->launchInfos = f;