You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Ben Mahler <be...@gmail.com> on 2014/03/03 21:41:12 UTC

Re: Review Request 18443: Changed Future::get to return a const reference.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/18443/#review36025
-----------------------------------------------------------



3rdparty/libprocess/include/process/future.hpp
<https://reviews.apache.org/r/18443/#comment66823>

    Can you revert back to <> includes per the other discussion?



3rdparty/libprocess/include/process/future.hpp
<https://reviews.apache.org/r/18443/#comment66821>

    Why? We intentionally added Failure as syntactic sugar. :)



3rdparty/libprocess/include/process/future.hpp
<https://reviews.apache.org/r/18443/#comment66820>

    Why this TODO? Failure is used to implicitly construct a Future, the copy occurring from the need to store the failure message inside Future. Which copy would be eliminated through an accessor?



3rdparty/libprocess/include/process/future.hpp
<https://reviews.apache.org/r/18443/#comment66818>

    Ditto about fatal performing exit(1) and us losing a stacktrace here since we're no longer getting SIGABRT. Can you revert for now?



3rdparty/libprocess/include/process/future.hpp
<https://reviews.apache.org/r/18443/#comment66816>

    Can you do this optimization in a separate review?



3rdparty/libprocess/src/tests/http_tests.cpp
<https://reviews.apache.org/r/18443/#comment66815>

    Can you kill this comment and just use .get() on the hashmap?
    
    EXPECT_EQ(http::statuses.get(200), future.get().status); // Avoid mutating http::statuses if you like, should work because Option<T> has == operator against T.
    EXPECT_SOME_EQ("chunked", future.get().headers.get("Transfer-Encoding"));
    EXPECT_EQ("Hello world\n", future.get().body);


- Ben Mahler


On Feb. 24, 2014, 11:36 p.m., Dominic Hamon wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/18443/
> -----------------------------------------------------------
> 
> (Updated Feb. 24, 2014, 11:36 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-1008
>     https://issues.apache.org/jira/browse/MESOS-1008
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> See summary
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/future.hpp e45f4f79faeefbffc28d855d2f74e8df69099f18 
>   3rdparty/libprocess/src/tests/http_tests.cpp 779c30b235506453a68f7a089dd4438e540fce5a 
> 
> Diff: https://reviews.apache.org/r/18443/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Dominic Hamon
> 
>


Re: Review Request 18443: Changed Future::get to return a const reference.

Posted by Ben Mahler <be...@gmail.com>.

> On March 3, 2014, 8:41 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/include/process/future.hpp, lines 92-93
> > <https://reviews.apache.org/r/18443/diff/1/?file=502836#file502836line92>
> >
> >     Why? We intentionally added Failure as syntactic sugar. :)
> 
> Dominic Hamon wrote:
>     multiple ways to do the same thing belie a poor API. There should be one way to create a failure.
>     
>     As it says "Consider..." :)
>

We created the helper to simplify code dealing with failures, this was the case for Error (error.hpp) as well:

Future<string> foo()
{
  return Failure("Not implemented"); // No <> templating needed.
}

vs.

Future<string> foo()
{
  return Future<string>::failure("Not implemented");
}

So if anything, we should consider deprecating the factory method instead. Feel free to move the TODO there instead if you want to keep it!


- Ben


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/18443/#review36025
-----------------------------------------------------------


On March 3, 2014, 9:23 p.m., Dominic Hamon wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/18443/
> -----------------------------------------------------------
> 
> (Updated March 3, 2014, 9:23 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-1008
>     https://issues.apache.org/jira/browse/MESOS-1008
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> See summary
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/future.hpp e45f4f79faeefbffc28d855d2f74e8df69099f18 
>   3rdparty/libprocess/src/tests/http_tests.cpp 779c30b235506453a68f7a089dd4438e540fce5a 
> 
> Diff: https://reviews.apache.org/r/18443/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Dominic Hamon
> 
>


Re: Review Request 18443: Changed Future::get to return a const reference.

Posted by Dominic Hamon <dh...@twopensource.com>.

> On March 3, 2014, 12:41 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/include/process/future.hpp, lines 26-27
> > <https://reviews.apache.org/r/18443/diff/1/?file=502836#file502836line26>
> >
> >     Can you revert back to <> includes per the other discussion?

i will, but this can introduce a bug should process ever be installed on someone's machine.


> On March 3, 2014, 12:41 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/include/process/future.hpp, lines 92-93
> > <https://reviews.apache.org/r/18443/diff/1/?file=502836#file502836line92>
> >
> >     Why? We intentionally added Failure as syntactic sugar. :)

multiple ways to do the same thing belie a poor API. There should be one way to create a failure.

As it says "Consider..." :)


> On March 3, 2014, 12:41 p.m., Ben Mahler wrote:
> > 3rdparty/libprocess/include/process/future.hpp, lines 544-545
> > <https://reviews.apache.org/r/18443/diff/1/?file=502836#file502836line544>
> >
> >     Why this TODO? Failure is used to implicitly construct a Future, the copy occurring from the need to store the failure message inside Future. Which copy would be eliminated through an accessor?

I thought someone might be accessing a Failure directly and copying out the message string. Of course, even better would be to remove this helper and just keep the explicit factory method. :)


- Dominic


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/18443/#review36025
-----------------------------------------------------------


On March 3, 2014, 1:23 p.m., Dominic Hamon wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/18443/
> -----------------------------------------------------------
> 
> (Updated March 3, 2014, 1:23 p.m.)
> 
> 
> Review request for mesos and Ben Mahler.
> 
> 
> Bugs: MESOS-1008
>     https://issues.apache.org/jira/browse/MESOS-1008
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> See summary
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/future.hpp e45f4f79faeefbffc28d855d2f74e8df69099f18 
>   3rdparty/libprocess/src/tests/http_tests.cpp 779c30b235506453a68f7a089dd4438e540fce5a 
> 
> Diff: https://reviews.apache.org/r/18443/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Dominic Hamon
> 
>