You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2015/06/15 11:34:33 UTC

mesos git commit: Fixed the dependency between 'summarize' and 'model'.

Repository: mesos
Updated Branches:
  refs/heads/master 2b4fb8356 -> c3333bbbc


Fixed the dependency between 'summarize' and 'model'.

Since `summarize` captures the important fields of an object, `model`
will always be a superset of it.
We can see that `model(const Framework&)` calls
`summarize(const Framework&)` and augments additional fields.

This patch removes the unnecessary forward declaration and makes
`model(const Slave&)` depend on `summarize(const Slave&)` instead.

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


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

Branch: refs/heads/master
Commit: c3333bbbcf4cfceb1420b24b6bc9e7688e2d8af6
Parents: 2b4fb83
Author: Michael Park <mc...@gmail.com>
Authored: Mon Jun 15 11:05:35 2015 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Mon Jun 15 11:05:35 2015 +0200

----------------------------------------------------------------------
 src/master/http.cpp | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c3333bbb/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index f8ac309..8b69413 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -128,9 +128,9 @@ JSON::Object summarize(const Framework& framework)
 // Returns a JSON object modeled on a Framework.
 JSON::Object model(const Framework& framework)
 {
-  // Add additional fields to those generated by 'summarize'.
   JSON::Object object = summarize(framework);
 
+  // Add additional fields to those generated by 'summarize'.
   object.values["user"] = framework.info.user();
   object.values["failover_timeout"] = framework.info.failover_timeout();
   object.values["checkpoint"] = framework.info.checkpoint();
@@ -196,23 +196,9 @@ JSON::Object model(const Framework& framework)
 }
 
 
-// Forward declaration for 'summarize(Slave)'.
-JSON::Object model(const Slave& slave);
-
-
 // Returns a JSON object summarizing some important fields in a Slave.
-// For now this just calls 'model(slave)' because all the fields in
-// 'model' are of value, and the model for a slave is not really heavy
-// weight.
 JSON::Object summarize(const Slave& slave)
 {
-  return model(slave);
-}
-
-
-// Returns a JSON object modeled after a Slave.
-JSON::Object model(const Slave& slave)
-{
   JSON::Object object;
   object.values["id"] = slave.id.value();
   object.values["pid"] = string(slave.pid);
@@ -233,6 +219,15 @@ JSON::Object model(const Slave& slave)
 }
 
 
+// Returns a JSON object modeled after a Slave.
+// For now there are no additional fields being added to those
+// generated by 'summarize'.
+JSON::Object model(const Slave& slave)
+{
+  return summarize(slave);
+}
+
+
 // Returns a JSON object modeled after a Role.
 JSON::Object model(const Role& role)
 {