Re: Review Request 70885: Renamed 'libprocess::network::Address::hostname()'.

2019-08-12 Thread Benno Evers


> On June 24, 2019, 4:20 p.m., Benjamin Mahler wrote:
> > 3rdparty/libprocess/include/process/address.hpp
> > Lines 65-68 (original), 70-74 (patched)
> > 
> >
> > It looks a little strange that stout's functions are 
> > hostname/getHostname but libprocess' is lookup_hostname.
> > 
> > Rather than change the name to signal the lookup, having this return a 
> > Future seems sufficient to signal the asynchronous nature of this operation 
> > (per the existing TODO):
> > 
> > ```
> > Future hostname = hostname();
> > 
> > // or
> > 
> > Future> hostnames = hostnames();
> > ```
> > 
> > That way, stout's `hostname()` is the synchronous blocking way to get 
> > it, and libprocess' `hostname()` asynchronous non-blocking way to get it.
> > 
> > I think that's generally the naming convention we'd like to stick to.

I think that changing the signature would not address the core of the problem, 
which is that in code like


```
host = address.hostname(); // `host` is some member variable
```

it would still be very hard for a reader to catch what's going on, unless he 
already has some prior knowledge that `host` is a future or `hostname()` will 
do a lookup.

Even in this version, it is very easy to overlook the `.get()`, or assume it 
belongs to a `Try`, `Option`, `shared_ptr`, etc.:

```
string host = address.hostname().get();
```

Renaming, on the other hand, is unambigous and impossible to miss.

Regarding stout, `net::hostname()` actually does something *different* than the 
function we're touching here, in particular it does **not** do a lookup. So it 
seems like the existing naming was confusing enough to fool even you ;)


- Benno


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


On June 19, 2019, 2:44 p.m., Benno Evers wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/70885/
> ---
> 
> (Updated June 19, 2019, 2:44 p.m.)
> 
> 
> Review request for mesos, Joseph Wu and Till Toenshoff.
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Renamed member function `hostname()` to `lookup_hostname()`,
> since the former name hides the fact that a call to this
> function involves a synchronous network access in order
> to make a reverse DNS lookup.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/include/process/address.hpp 
> e740e840c38381bafd7a1a7fcde5f963832ac1fb 
>   3rdparty/libprocess/src/tests/http_tests.cpp 
> 97aaf3ed3d4fab6d717d5c9b6d12402562ac6b46 
>   3rdparty/libprocess/src/tests/ssl_tests.cpp 
> 6b8496aeeed79ae1bd39d7013f4f403b248fdd4c 
> 
> 
> Diff: https://reviews.apache.org/r/70885/diff/1/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Benno Evers
> 
>



Re: Review Request 70885: Renamed 'libprocess::network::Address::hostname()'.

2019-06-24 Thread Benjamin Mahler

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




3rdparty/libprocess/include/process/address.hpp
Lines 65-68 (original), 70-74 (patched)


It looks a little strange that stout's functions are hostname/getHostname 
but libprocess' is lookup_hostname.

Rather than change the name to signal the lookup, having this return a 
Future seems sufficient to signal the asynchronous nature of this operation 
(per the existing TODO):

```
Future hostname = hostname();

// or

Future> hostnames = hostnames();
```

That way, stout's `hostname()` is the synchronous blocking way to get it, 
and libprocess' `hostname()` asynchronous non-blocking way to get it.

I think that's generally the naming convention we'd like to stick to.


- Benjamin Mahler


On June 19, 2019, 2:44 p.m., Benno Evers wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/70885/
> ---
> 
> (Updated June 19, 2019, 2:44 p.m.)
> 
> 
> Review request for mesos, Joseph Wu and Till Toenshoff.
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Renamed member function `hostname()` to `lookup_hostname()`,
> since the former name hides the fact that a call to this
> function involves a synchronous network access in order
> to make a reverse DNS lookup.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/include/process/address.hpp 
> e740e840c38381bafd7a1a7fcde5f963832ac1fb 
>   3rdparty/libprocess/src/tests/http_tests.cpp 
> 97aaf3ed3d4fab6d717d5c9b6d12402562ac6b46 
>   3rdparty/libprocess/src/tests/ssl_tests.cpp 
> 6b8496aeeed79ae1bd39d7013f4f403b248fdd4c 
> 
> 
> Diff: https://reviews.apache.org/r/70885/diff/1/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Benno Evers
> 
>



Re: Review Request 70885: Renamed 'libprocess::network::Address::hostname()'.

2019-06-20 Thread Till Toenshoff via Review Board

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


Ship it!




Thanks a bunch - much better signal for a pricy function now :)

- Till Toenshoff


On June 19, 2019, 2:44 p.m., Benno Evers wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/70885/
> ---
> 
> (Updated June 19, 2019, 2:44 p.m.)
> 
> 
> Review request for mesos, Joseph Wu and Till Toenshoff.
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Renamed member function `hostname()` to `lookup_hostname()`,
> since the former name hides the fact that a call to this
> function involves a synchronous network access in order
> to make a reverse DNS lookup.
> 
> 
> Diffs
> -
> 
>   3rdparty/libprocess/include/process/address.hpp 
> e740e840c38381bafd7a1a7fcde5f963832ac1fb 
>   3rdparty/libprocess/src/tests/http_tests.cpp 
> 97aaf3ed3d4fab6d717d5c9b6d12402562ac6b46 
>   3rdparty/libprocess/src/tests/ssl_tests.cpp 
> 6b8496aeeed79ae1bd39d7013f4f403b248fdd4c 
> 
> 
> Diff: https://reviews.apache.org/r/70885/diff/1/
> 
> 
> Testing
> ---
> 
> 
> Thanks,
> 
> Benno Evers
> 
>



Review Request 70885: Renamed 'libprocess::network::Address::hostname()'.

2019-06-19 Thread Benno Evers

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

Review request for mesos, Joseph Wu and Till Toenshoff.


Repository: mesos


Description
---

Renamed member function `hostname()` to `lookup_hostname()`,
since the former name hides the fact that a call to this
function involves a synchronous network access in order
to make a reverse DNS lookup.


Diffs
-

  3rdparty/libprocess/include/process/address.hpp 
e740e840c38381bafd7a1a7fcde5f963832ac1fb 
  3rdparty/libprocess/src/tests/http_tests.cpp 
97aaf3ed3d4fab6d717d5c9b6d12402562ac6b46 
  3rdparty/libprocess/src/tests/ssl_tests.cpp 
6b8496aeeed79ae1bd39d7013f4f403b248fdd4c 


Diff: https://reviews.apache.org/r/70885/diff/1/


Testing
---


Thanks,

Benno Evers