You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2014/01/25 01:14:42 UTC

[1/7] git commit: Added some missing includes.

Updated Branches:
  refs/heads/master 45a773922 -> 73d8498fe


Added some missing includes.

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


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

Branch: refs/heads/master
Commit: c50784e67884e23981953ea5002dbadcc73a9c97
Parents: 5bc2d73
Author: Benjamin Hindman <be...@gmail.com>
Authored: Sat Jan 18 10:21:02 2014 -0800
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Fri Jan 24 16:14:01 2014 -0800

----------------------------------------------------------------------
 src/java/jni/convert.hpp                               | 2 +-
 src/java/jni/org_apache_mesos_MesosSchedulerDriver.cpp | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c50784e6/src/java/jni/convert.hpp
----------------------------------------------------------------------
diff --git a/src/java/jni/convert.hpp b/src/java/jni/convert.hpp
index d0acf07..073dbf2 100644
--- a/src/java/jni/convert.hpp
+++ b/src/java/jni/convert.hpp
@@ -21,7 +21,7 @@
 
 #include <jni.h>
 
-#include <stout/try.hpp>
+#include <stout/result.hpp>
 
 template <typename T>
 jobject convert(JNIEnv* env, const T& t);

http://git-wip-us.apache.org/repos/asf/mesos/blob/c50784e6/src/java/jni/org_apache_mesos_MesosSchedulerDriver.cpp
----------------------------------------------------------------------
diff --git a/src/java/jni/org_apache_mesos_MesosSchedulerDriver.cpp b/src/java/jni/org_apache_mesos_MesosSchedulerDriver.cpp
index 9869929..5d6492d 100644
--- a/src/java/jni/org_apache_mesos_MesosSchedulerDriver.cpp
+++ b/src/java/jni/org_apache_mesos_MesosSchedulerDriver.cpp
@@ -23,6 +23,7 @@
 #include <mesos/scheduler.hpp>
 
 #include <stout/foreach.hpp>
+#include <stout/result.hpp>
 #include <stout/try.hpp>
 
 #include "jvm/jvm.hpp"


[3/7] git commit: Updated http tests in libprocess for the new get/post interfaces.

Posted by be...@apache.org.
Updated http tests in libprocess for the new get/post interfaces.

From: Jie Yu <yu...@gmail.com>
Review: https://reviews.apache.org/r/17077


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

Branch: refs/heads/master
Commit: b8a0dd30a83c64225f65f7916506da721a7c389d
Parents: 170b854
Author: Benjamin Hindman <be...@gmail.com>
Authored: Sat Jan 18 10:23:26 2014 -0800
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Fri Jan 24 16:14:01 2014 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/src/tests/http_tests.cpp | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b8a0dd30/3rdparty/libprocess/src/tests/http_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/http_tests.cpp b/3rdparty/libprocess/src/tests/http_tests.cpp
index c27e027..62ab64d 100644
--- a/3rdparty/libprocess/src/tests/http_tests.cpp
+++ b/3rdparty/libprocess/src/tests/http_tests.cpp
@@ -231,7 +231,7 @@ TEST(HTTP, Get)
     .WillOnce(Invoke(validateGetWithQuery));
 
   Future<http::Response> queryFuture =
-    http::get(process.self(), "get", Some("foo=bar#frag"));
+    http::get(process.self(), "get", "foo=bar#frag");
 
   AWAIT_READY(queryFuture);
   ASSERT_EQ(http::statuses[200], queryFuture.get().status);
@@ -261,11 +261,17 @@ TEST(HTTP, Post)
 
   spawn(process);
 
+  // Test the case where there is a content type but no body.
+  Future<http::Response> future =
+    http::post(process.self(), "post", None(), "text/plain");
+
+  AWAIT_EXPECT_FAILED(future);
+
   EXPECT_CALL(process, post(_))
     .WillOnce(Invoke(validatePost));
 
-  Future<http::Response> future =
-    http::post(process.self(), "post", "text/plain", "This is the payload.");
+  future =
+    http::post(process.self(), "post", "This is the payload.", "text/plain");
 
   AWAIT_READY(future);
   ASSERT_EQ(http::statuses[200], future.get().status);


[7/7] git commit: Bug in http::request missing os::close.

Posted by be...@apache.org.
Bug in http::request missing os::close.

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


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

Branch: refs/heads/master
Commit: 73d8498feb72863cc09d3aba578f51fc6f3e45c2
Parents: c50784e
Author: Benjamin Hindman <be...@gmail.com>
Authored: Sat Jan 18 11:30:05 2014 -0800
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Fri Jan 24 16:14:02 2014 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/src/process.cpp | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/73d8498f/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index 6ebeb62..c28fc35 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -3635,6 +3635,7 @@ Future<Response> request(
 
   Try<Nothing> cloexec = os::cloexec(s);
   if (!cloexec.isSome()) {
+    os::close(s);
     return Failure("Failed to cloexec: " + cloexec.error());
   }
 


[2/7] git commit: Added overload of numify.

Posted by be...@apache.org.
Added overload of numify.

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


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

Branch: refs/heads/master
Commit: 5bc2d73df366fd59fc3f1ae10dd9d0861ba191db
Parents: df8ffd0
Author: Benjamin Hindman <be...@gmail.com>
Authored: Sat Jan 18 10:20:36 2014 -0800
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Fri Jan 24 16:14:01 2014 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/stout/include/stout/numify.hpp | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5bc2d73d/3rdparty/libprocess/3rdparty/stout/include/stout/numify.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/numify.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/numify.hpp
index ef49fbb..ddd3dd9 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/numify.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/numify.hpp
@@ -36,6 +36,13 @@ Try<T> numify(const std::string& s)
 
 
 template <typename T>
+Try<T> numify(const char* s)
+{
+  return numify<T>(std::string(s));
+}
+
+
+template <typename T>
 Result<T> numify(const Option<std::string>& s)
 {
   if (s.isSome()) {


[4/7] git commit: Refined http get/post interfaces to use Option.

Posted by be...@apache.org.
Refined http get/post interfaces to use Option.

From: Jie Yu <yu...@gmail.com>
Review: https://reviews.apache.org/r/17076


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

Branch: refs/heads/master
Commit: 170b854b424c5a9d0272f98f128842f9a9d5afa8
Parents: 45a7739
Author: Benjamin Hindman <be...@gmail.com>
Authored: Sat Jan 18 10:23:17 2014 -0800
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Fri Jan 24 16:14:01 2014 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/http.hpp | 17 +++-------
 3rdparty/libprocess/src/process.cpp          | 40 ++++++++++++++---------
 2 files changed, 29 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/170b854b/3rdparty/libprocess/include/process/http.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/http.hpp b/3rdparty/libprocess/include/process/http.hpp
index a8b1636..414a2b2 100644
--- a/3rdparty/libprocess/include/process/http.hpp
+++ b/3rdparty/libprocess/include/process/http.hpp
@@ -481,26 +481,17 @@ inline Try<std::string> decode(const std::string& s)
 // on the read stream, rather than parsing the full string response at the end.
 Future<Response> get(
     const UPID& upid,
-    const std::string& path = "",
+    const Option<std::string>& path = None(),
     const Option<std::string>& query = None());
 
 
-// Backwards compatible wrapper for the above.
-// There are clients who pass in string literals to query that cannot be
-// converted automatically to Option<string>.
-Future<Response> get(
-    const UPID& upid,
-    const std::string& path,
-    const std::string& query);
-
-
 // Sends a blocking HTTP POST request to the process with the given upid.
 // Returns the HTTP response from the process, read asyncronously.
 Future<Response> post(
     const UPID& upid,
-    const std::string& path,
-    const std::string& contentType,
-    const std::string& body);
+    const Option<std::string>& path = None(),
+    const Option<std::string>& body = None(),
+    const Option<std::string>& contentType = None());
 
 
 // Status code reason strings, from the HTTP1.1 RFC:

http://git-wip-us.apache.org/repos/asf/mesos/blob/170b854b/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index bc7a1c5..6ebeb62 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -3622,10 +3622,10 @@ Future<Response> decode(const string& buffer)
 Future<Response> request(
     const UPID& upid,
     const string& method,
-    const string& path,
+    const Option<string>& path,
     const Option<string>& query,
-    const Option<string>& contentType,
-    const Option<string>& body)
+    const Option<string>& body,
+    const Option<string>& contentType)
 {
   int s = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
 
@@ -3651,10 +3651,16 @@ Future<Response> request(
 
   std::ostringstream out;
 
-  out << method << " /" << upid.id << "/" << path;
+  out << method << " /" << upid.id;
+
+  if (path.isSome()) {
+    out << "/" << path.get();
+  }
+
   if (query.isSome()) {
     out << "?" << query.get();
   }
+
   out << " HTTP/1.1\r\n";
 
   // Call inet_ntop since inet_ntoa is not thread-safe!
@@ -3664,6 +3670,11 @@ Future<Response> request(
   out << "Host: " << ip << ":" << upid.port << "\r\n"
       << "Connection: close\r\n";
 
+  if (body.isNone() && contentType.isSome()) {
+    os::close(s);
+    return Failure("Attempted to do a POST with a Content-Type but no body");
+  }
+
   if (contentType.isSome()) {
     out << "Content-Type: " << contentType.get() << "\r\n";
   }
@@ -3709,23 +3720,22 @@ Future<Response> request(
 } // namespace internal {
 
 
-Future<Response> get(const UPID& upid, const string& path, const Option<string>& query)
+Future<Response> get(
+    const UPID& upid,
+    const Option<string>& path,
+    const Option<string>& query)
 {
   return internal::request(upid, "GET", path, query, None(), None());
 }
 
 
-// Overload for back-compat.
-Future<Response> get(const UPID& upid, const string& path, const string& query)
-{
-   //In this overload empty string means no query.
-   return get(upid, path, query.empty() ? Option<string>::none() : Some(query));
-}
-
-
-Future<Response> post(const UPID& upid, const string& path, const string& contentType, const string& body)
+Future<Response> post(
+    const UPID& upid,
+    const Option<string>& path,
+    const Option<string>& body,
+    const Option<string>& contentType)
 {
-  return internal::request(upid, "POST", path, None(), contentType, body);
+  return internal::request(upid, "POST", path, None(), body, contentType);
 }
 
 }  // namespace http {


[6/7] git commit: Added a conversion constructor to Future.

Posted by be...@apache.org.
Added a conversion constructor to Future.

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


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

Branch: refs/heads/master
Commit: df8ffd01ce694ef6d45ee2b41b1334ab74d93ccf
Parents: 48e663e
Author: Benjamin Hindman <be...@gmail.com>
Authored: Sat Jan 18 10:17:20 2014 -0800
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Fri Jan 24 16:14:01 2014 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/future.hpp | 52 +++++++++++++--------
 1 file changed, 32 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/df8ffd01/3rdparty/libprocess/include/process/future.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/future.hpp b/3rdparty/libprocess/include/process/future.hpp
index 2a5f124..aaf17af 100644
--- a/3rdparty/libprocess/include/process/future.hpp
+++ b/3rdparty/libprocess/include/process/future.hpp
@@ -51,6 +51,9 @@ class Promise;
 template <typename T>
 class WeakFuture;
 
+// Forward declaration of Failure.
+struct Failure;
+
 
 // Definition of a "shared" future. A future can hold any
 // copy-constructible value. A future is considered "shared" because
@@ -63,8 +66,16 @@ public:
   static Future<T> failed(const std::string& message);
 
   Future();
+
   Future(const T& _t);
+
+  template <typename U>
+  Future(const U& u);
+
+  Future(const Failure& failure);
+
   Future(const Future<T>& that);
+
   ~Future();
 
   // Futures are assignable (and copyable). This results in the
@@ -490,33 +501,17 @@ void discard(WeakFuture<T> reference)
 
 } // namespace internal {
 
+
 // Helper for creating failed futures.
-struct _Failure
+struct Failure
 {
-  _Failure(const std::string& _message) : message(_message) {}
-
-  template <typename T>
-  operator Future<T> () const
-  {
-    return Future<T>::failed(message);
-  }
+  Failure(const std::string& _message) : message(_message) {}
+  Failure(const Error& error) : message(error.message) {}
 
   const std::string message;
 };
 
 
-inline _Failure Failure(const std::string& message)
-{
-  return _Failure(message);
-}
-
-
-inline _Failure Failure(const Error& error)
-{
-  return _Failure(error.message);
-}
-
-
 // TODO(benh): Make Promise a subclass of Future?
 template <typename T>
 class Promise
@@ -801,6 +796,23 @@ Future<T>::Future(const T& _t)
 
 
 template <typename T>
+template <typename U>
+Future<T>::Future(const U& u)
+  : data(new Data())
+{
+  set(u);
+}
+
+
+template <typename T>
+Future<T>::Future(const Failure& failure)
+  : data(new Data())
+{
+  fail(failure.message);
+}
+
+
+template <typename T>
 Future<T>::Future(const Future<T>& that)
   : data(that.data) {}
 


[5/7] git commit: Refactored implicit conversions of Some, None, and Error.

Posted by be...@apache.org.
Refactored implicit conversions of Some, None, and Error.

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


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

Branch: refs/heads/master
Commit: 48e663e3614006ab0a3cb1a772dcad2c201c0028
Parents: b8a0dd3
Author: Benjamin Hindman <be...@gmail.com>
Authored: Fri Jan 17 15:25:09 2014 -0800
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Fri Jan 24 16:14:01 2014 -0800

----------------------------------------------------------------------
 .../3rdparty/stout/include/stout/error.hpp      | 55 ++++------------
 .../stout/include/stout/flags/flags.hpp         | 18 ------
 .../3rdparty/stout/include/stout/none.hpp       | 63 ++++--------------
 .../3rdparty/stout/include/stout/option.hpp     | 10 +++
 .../3rdparty/stout/include/stout/result.hpp     | 23 ++++++-
 .../3rdparty/stout/include/stout/some.hpp       | 67 ++++----------------
 .../3rdparty/stout/include/stout/try.hpp        | 14 +++-
 7 files changed, 82 insertions(+), 168 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/48e663e3/3rdparty/libprocess/3rdparty/stout/include/stout/error.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/error.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/error.hpp
index b08ae50..12ba1ca 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/error.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/error.hpp
@@ -19,55 +19,24 @@
 
 #include <string>
 
-#include "result.hpp"
-#include "try.hpp"
-
-// An "error" type that is implicitly convertible to a Try<T> or
-// Result<T> for any T (effectively "syntactic sugar" to make code
-// more readable). The implementation uses cast operators to perform
-// the conversions instead of adding constructors to Try/Result
-// directly. One could imagine revisiting that decision for C++11
-// because the use of rvalue reference could eliminate some
-// unnecessary copies. However, performance is not critical since
-// Error should not get called very often in practice (if so, it's
-// probably being used for things that aren't really errors or there
-// is a more serious problem during execution).
+// A useful type that can be used to represent a Try that has
+// failed. You can also use 'ErrnoError' to append the error message
+// associated with the current 'errno' to your own error message.
+//
+// Examples:
+//
+//   Result<int> result = Error("uninitialized");
+//   Try<std::string> = Error("uninitialized");
+//
+//   void foo(Try<std::string> t) {}
+//
+//   foo(Error("some error here"));
 
 class Error
 {
 public:
   explicit Error(const std::string& _message) : message(_message) {}
 
-  template <typename T>
-  operator Try<T> () const
-  {
-    return Try<T>::error(message);
-  }
-
-  // Give the compiler some help for nested Try<T>. For example,
-  // enable converting Error to an Option<Try<T>>. Note that this will
-  // bind to the innermost Try<T>.
-  template <template <typename> class S, typename T>
-  operator S<Try<T> > () const
-  {
-    return S<Try<T> >(Try<T>::error(message));
-  }
-
-  template <typename T>
-  operator Result<T> () const
-  {
-    return Result<T>::error(message);
-  }
-
-  // Give the compiler some help for nested Result<T>. For example,
-  // enable converting Error to an Option<Result<T>>. Note that this
-  // will bind to the innermost Result<T>.
-  template <template <typename> class S, typename T>
-  operator S<Result<T> > () const
-  {
-    return S<Result<T> >(Result<T>::error(message));
-  }
-
   const std::string message;
 };
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/48e663e3/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp
index e95ced4..883926b 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp
@@ -62,13 +62,6 @@ public:
       bool unknowns = false,
       bool duplicates = false);
 
-  Try<Nothing> load(
-      const std::string& prefix,
-      int argc,
-      char** argv,
-      bool unknowns = false,
-      bool duplicates = false);
-
   virtual Try<Nothing> load(
       const std::map<std::string, Option<std::string> >& values,
       bool unknowns = false);
@@ -384,17 +377,6 @@ inline Try<Nothing> FlagsBase::load(
 
 
 inline Try<Nothing> FlagsBase::load(
-    const std::string& prefix,
-    int argc,
-    char** argv,
-    bool unknowns,
-    bool duplicates)
-{
-  return load(Some(prefix), argc, argv, unknowns, duplicates);
-}
-
-
-inline Try<Nothing> FlagsBase::load(
     const std::map<std::string, Option<std::string> >& values,
     bool unknowns)
 {

http://git-wip-us.apache.org/repos/asf/mesos/blob/48e663e3/3rdparty/libprocess/3rdparty/stout/include/stout/none.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/none.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/none.hpp
index 43bc2a5..ce94fef 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/none.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/none.hpp
@@ -14,56 +14,17 @@
 #ifndef __STOUT_NONE_HPP__
 #define __STOUT_NONE_HPP__
 
-#include "option.hpp"
-#include "result.hpp"
-
-// A "none" type that is implicitly convertible to an Option<T> and
-// Result<T> for any T (effectively "syntactic sugar" to make code
-// more readable). The implementation uses cast operators to perform
-// the conversions instead of adding constructors to Option/Result
-// directly. Performance shouldn't be an issue given that an instance
-// of None has no virtual functions and no fields.
-
-class None
-{
-public:
-  template <typename T>
-  operator Option<T> () const
-  {
-    return Option<T>::none();
-  }
-
-  // Give the compiler some help for nested Option<T>. For example,
-  // enable converting None to a Try<Option<T>>. Note that this will
-  // bind to the innermost Option<T>.
-  template <template <typename> class S, typename T>
-  operator S<Option<T> > () const
-  {
-    return S<Option<T> >(Option<T>::none());
-  }
-
-  template <typename T>
-  operator Result<T> () const
-  {
-    return Result<T>::none();
-  }
-
-  // Give the compiler some help for nested Result<T>. For example,
-  // enable converting None to a Try<Result<T>>. Note that this will
-  // bind to the innermost Result<T>.
-  template <template <typename> class S, typename T>
-  operator S<Result<T> > () const
-  {
-    return S<Result<T> >(Result<T>::none());
-  }
-
-  // Give the compiler some more help to disambiguate the above cast
-  // operators from Result<Option<T>>.
-  template <typename T>
-  operator Result<Option<T> > () const
-  {
-    return Result<Option<T> >::none();
-  }
-};
+// A useful type that can be used to represent an Option or Result.
+//
+// Examples:
+//
+//   Result<int> result = None();
+//   Option<std::string> = None();
+//
+//   void foo(Option<int> o = None()) {}
+//
+//   foo(None());
+
+struct None {};
 
 #endif // __STOUT_NONE_HPP__

http://git-wip-us.apache.org/repos/asf/mesos/blob/48e663e3/3rdparty/libprocess/3rdparty/stout/include/stout/option.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/option.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/option.hpp
index 432a12b..259c463 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/option.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/option.hpp
@@ -18,7 +18,9 @@
 
 #include <algorithm>
 
+#include <stout/none.hpp>
 #include <stout/result.hpp>
+#include <stout/some.hpp>
 
 template <typename T>
 class Option
@@ -38,6 +40,14 @@ public:
 
   Option(const T& _t) : state(SOME), t(new T(_t)) {}
 
+  template <typename U>
+  Option(const U& u) : state(SOME), t(new T(u)) {}
+
+  Option(const None& none) : state(NONE), t(NULL) {}
+
+  template <typename U>
+  Option(const _Some<U>& some) : state(SOME), t(new T(some.t)) {}
+
   Option(const Option<T>& that)
   {
     state = that.state;

http://git-wip-us.apache.org/repos/asf/mesos/blob/48e663e3/3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp
index cf2b243..ab15f01 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/result.hpp
@@ -20,6 +20,9 @@
 #include <iostream>
 #include <string>
 
+#include <stout/error.hpp>
+#include <stout/none.hpp>
+#include <stout/some.hpp>
 
 template <typename T>
 class Result
@@ -40,7 +43,25 @@ public:
     return Result<T>(ERROR, NULL, message);
   }
 
-  Result(const T& _t) : state(SOME), t(new T(_t)) {}
+  Result(const T& _t)
+    : state(SOME), t(new T(_t)) {}
+
+  template <typename U>
+  Result(const U& u)
+    : state(SOME), t(new T(u)) {}
+
+  Result(const None& none)
+    : state(NONE), t(NULL) {}
+
+  template <typename U>
+  Result(const _Some<U>& some)
+    : state(SOME), t(new T(some.t)) {}
+
+  Result(const Error& error)
+    : state(ERROR), t(NULL), message(error.message) {}
+
+  Result(const ErrnoError& error)
+    : state(ERROR), t(NULL), message(error.message) {}
 
   Result(const Result<T>& that)
   {

http://git-wip-us.apache.org/repos/asf/mesos/blob/48e663e3/3rdparty/libprocess/3rdparty/stout/include/stout/some.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/some.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/some.hpp
index 885a4ae..1a71ac4 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/some.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/some.hpp
@@ -14,65 +14,24 @@
 #ifndef __STOUT_SOME_HPP__
 #define __STOUT_SOME_HPP__
 
-#include <stout/option.hpp>
-#include <stout/result.hpp>
-
-// A "some" type that is implicitely convertable to an Option<T> and
-// Result<T> for any T (effectively "syntactic sugar" to make code
-// more readable). The implementation uses cast operators to perform
-// the conversions instead of adding constructors to Option/Result
-// directly. The extra copies involved here can be elided with C++11
-// rvalue references. Furthermore, since in most circumstances a Some
-// will not be needed (an Option<T> or Result<T> can be constructed
-// directly from the value) we don't worry about performance.
-
+// A useful type that can be used to represent an Option or Result.
+//
+// Examples:
+//
+//   Result<int> result = Some(42);
+//   Option<std::string> = Some("hello world");
+//
+//   void foo(Option<std::string> o) {}
+//
+//   foo(Some("hello world"));
+
+// NOTE: We use an intermediate type, _Some, so that one doesn't need
+// to explicitly define the template type when doing 'Some(value)'.
 template <typename T>
 struct _Some
 {
   _Some(T _t) : t(_t) {}
 
-  template <typename U>
-  operator Option<U> () const
-  {
-    return Option<U>::some(t);
-  }
-
-  // Give the compiler some help for nested Option<U>.
-  template <template <typename> class S, typename U>
-  operator S<Option<U> > () const
-  {
-    return S<Option<U> >(Option<U>::some(t));
-  }
-
-  template <typename U>
-  operator Result<U> () const
-  {
-    return Result<U>::some(t);
-  }
-
-  // Give the compiler some help for nested Result<U>.
-  template <template <typename> class S, typename U>
-  operator S<Result<U> > () const
-  {
-    return S<Result<U> >(Result<U>::some(t));
-  }
-
-  // Give the compiler some more help to disambiguate the above cast
-  // operators from Option<Result<U>>.
-  template <typename U>
-  operator Option<Result<U> > () const
-  {
-    return Option<Result<U> >::some(t);
-  }
-
-  // Give the compiler some more help to disambiguate the above cast
-  // operators from Result<Option<U>>.
-  template <typename U>
-  operator Result<Option<U> > () const
-  {
-    return Result<Option<U> >::some(t);
-  }
-
   const T t;
 };
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/48e663e3/3rdparty/libprocess/3rdparty/stout/include/stout/try.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/try.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/try.hpp
index b02d354..6a56c7d 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/try.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/try.hpp
@@ -20,6 +20,7 @@
 #include <iostream>
 #include <string>
 
+#include <stout/error.hpp>
 
 template <typename T>
 class Try
@@ -35,7 +36,18 @@ public:
     return Try<T>(ERROR, NULL, message);
   }
 
-  Try(const T& _t) : state(SOME), t(new T(_t)) {}
+  Try(const T& _t)
+    : state(SOME), t(new T(_t)) {}
+
+  template <typename U>
+  Try(const U& u)
+    : state(SOME), t(new T(u)) {}
+
+  Try(const Error& error)
+    : state(ERROR), t(NULL), message(error.message) {}
+
+  Try(const ErrnoError& error)
+    : state(ERROR), t(NULL), message(error.message) {}
 
   Try(const Try<T>& that)
   {