You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Benjamin Bannier <bb...@apache.org> on 2019/12/05 12:48:53 UTC

Review Request 71878: Added iteration support to stout's Path.

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

Review request for mesos and Benno Evers.


Bugs: MESOS-10062
    https://issues.apache.org/jira/browse/MESOS-10062


Repository: mesos


Description
-------

Added iteration support to stout's Path.


Diffs
-----

  3rdparty/stout/include/stout/path.hpp ba1f665ce94b9636d88a7ecce8643c56758f7b5c 
  3rdparty/stout/tests/path_tests.cpp 19dd910a534040468aeb48f15ebdf56dff32bc15 


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


Testing
-------

`make check`


Thanks,

Benjamin Bannier


Re: Review Request 71878: Added iteration support to stout's Path.

Posted by Benjamin Bannier <bb...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/71878/
-----------------------------------------------------------

(Updated Dec. 9, 2019, 5:48 p.m.)


Review request for mesos and Benno Evers.


Changes
-------

Correct changeset


Bugs: MESOS-10062
    https://issues.apache.org/jira/browse/MESOS-10062


Repository: mesos


Description
-------

Added iteration support to stout's Path.


Diffs (updated)
-----

  3rdparty/stout/include/stout/path.hpp ba1f665ce94b9636d88a7ecce8643c56758f7b5c 
  3rdparty/stout/tests/path_tests.cpp 19dd910a534040468aeb48f15ebdf56dff32bc15 


Diff: https://reviews.apache.org/r/71878/diff/3/

Changes: https://reviews.apache.org/r/71878/diff/2-3/


Testing
-------

`make check`


Thanks,

Benjamin Bannier


Re: Review Request 71878: Added iteration support to stout's Path.

Posted by Benjamin Bannier <bb...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/71878/
-----------------------------------------------------------

(Updated Dec. 9, 2019, 5:38 p.m.)


Review request for mesos and Benno Evers.


Bugs: MESOS-10062
    https://issues.apache.org/jira/browse/MESOS-10062


Repository: mesos


Description
-------

Added iteration support to stout's Path.


Diffs (updated)
-----

  3rdparty/stout/include/stout/path.hpp ba1f665ce94b9636d88a7ecce8643c56758f7b5c 
  3rdparty/stout/tests/path_tests.cpp 19dd910a534040468aeb48f15ebdf56dff32bc15 


Diff: https://reviews.apache.org/r/71878/diff/2/

Changes: https://reviews.apache.org/r/71878/diff/1-2/


Testing
-------

`make check`


Thanks,

Benjamin Bannier


Re: Review Request 71878: Added iteration support to stout's Path.

Posted by Benjamin Bannier <bb...@apache.org>.

> On Dec. 9, 2019, 3:34 p.m., Benno Evers wrote:
> > 3rdparty/stout/include/stout/path.hpp
> > Lines 388 (patched)
> > <https://reviews.apache.org/r/71878/diff/1/?file=2182150#file2182150line388>
> >
> >     This feels a bit more "common" to me:
> >     
> >         struct PathComponentIterator {
> >             // ..
> >         };
> >         
> >         typedef const PathComponentIterator const_iterator;
> >         
> >     What do you think?

I'd vote to not do this as we do not need it.


> On Dec. 9, 2019, 3:34 p.m., Benno Evers wrote:
> > 3rdparty/stout/include/stout/path.hpp
> > Lines 389 (patched)
> > <https://reviews.apache.org/r/71878/diff/1/?file=2182150#file2182150line389>
> >
> >     Using `std::iterator` is going to be deprecated in C++17, apparently the preferred alternative is to just create typedefs for `value_type`, etc. in the iterator class directly.

I'll do that since it also documents more what is happening in a more obvious way.


> On Dec. 9, 2019, 3:34 p.m., Benno Evers wrote:
> > 3rdparty/stout/include/stout/path.hpp
> > Lines 437 (patched)
> > <https://reviews.apache.org/r/71878/diff/1/?file=2182150#file2182150line437>
> >
> >     I think this needs to be a loop, consider e.g. `/home/foo////bar`

That would be path normalization which I didn't want to do in this class as it has a number of other complications. For a path like `/home/foo//bar` we would like to generate elements `{"home", "foo", "", "bar"}`. I'll clean up remnants of my attempts in this class here and in tests.


> On Dec. 9, 2019, 3:34 p.m., Benno Evers wrote:
> > 3rdparty/stout/include/stout/path.hpp
> > Lines 454 (patched)
> > <https://reviews.apache.org/r/71878/diff/1/?file=2182150#file2182150line454>
> >
> >     Should we also check `path == other.path`? Or maybe even `CHECK(path == other.path)`?

I'll end the hard `CHECK` once I have gotten rid of the end sentinel.


> On Dec. 9, 2019, 3:34 p.m., Benno Evers wrote:
> > 3rdparty/stout/include/stout/path.hpp
> > Lines 469 (patched)
> > <https://reviews.apache.org/r/71878/diff/1/?file=2182150#file2182150line469>
> >
> >     I don't completely understand why we need a sentinel, isn't `path->end()` suitable for everything we need to do?

I removed as per our offline discussion.


- Benjamin


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


On Dec. 9, 2019, 5:38 p.m., Benjamin Bannier wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/71878/
> -----------------------------------------------------------
> 
> (Updated Dec. 9, 2019, 5:38 p.m.)
> 
> 
> Review request for mesos and Benno Evers.
> 
> 
> Bugs: MESOS-10062
>     https://issues.apache.org/jira/browse/MESOS-10062
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added iteration support to stout's Path.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/stout/path.hpp ba1f665ce94b9636d88a7ecce8643c56758f7b5c 
>   3rdparty/stout/tests/path_tests.cpp 19dd910a534040468aeb48f15ebdf56dff32bc15 
> 
> 
> Diff: https://reviews.apache.org/r/71878/diff/2/
> 
> 
> Testing
> -------
> 
> `make check`
> 
> 
> Thanks,
> 
> Benjamin Bannier
> 
>


Re: Review Request 71878: Added iteration support to stout's Path.

Posted by Benno Evers <be...@mesosphere.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/71878/#review218978
-----------------------------------------------------------




3rdparty/stout/include/stout/path.hpp
Lines 388 (patched)
<https://reviews.apache.org/r/71878/#comment306970>

    This feels a bit more "common" to me:
    
        struct PathComponentIterator {
            // ..
        };
        
        typedef const PathComponentIterator const_iterator;
        
    What do you think?



3rdparty/stout/include/stout/path.hpp
Lines 389 (patched)
<https://reviews.apache.org/r/71878/#comment306968>

    Using `std::iterator` is going to be deprecated in C++17, apparently the preferred alternative is to just create typedefs for `value_type`, etc. in the iterator class directly.



3rdparty/stout/include/stout/path.hpp
Lines 391 (patched)
<https://reviews.apache.org/r/71878/#comment306971>

    Shouldn't `value_type` be `std::string`? (or the `string_view`-like class from the TODO below)



3rdparty/stout/include/stout/path.hpp
Lines 437 (patched)
<https://reviews.apache.org/r/71878/#comment306973>

    I think this needs to be a loop, consider e.g. `/home/foo////bar`



3rdparty/stout/include/stout/path.hpp
Lines 454 (patched)
<https://reviews.apache.org/r/71878/#comment306972>

    Should we also check `path == other.path`? Or maybe even `CHECK(path == other.path)`?



3rdparty/stout/include/stout/path.hpp
Lines 469 (patched)
<https://reviews.apache.org/r/71878/#comment306974>

    I don't completely understand why we need a sentinel, isn't `path->end()` suitable for everything we need to do?



3rdparty/stout/include/stout/path.hpp
Lines 479 (patched)
<https://reviews.apache.org/r/71878/#comment306969>

    Why not store a `Path*` here? Then we would not need to have an extra copy of `separator` in the iterator.


- Benno Evers


On Dec. 5, 2019, 12:48 p.m., Benjamin Bannier wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/71878/
> -----------------------------------------------------------
> 
> (Updated Dec. 5, 2019, 12:48 p.m.)
> 
> 
> Review request for mesos and Benno Evers.
> 
> 
> Bugs: MESOS-10062
>     https://issues.apache.org/jira/browse/MESOS-10062
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added iteration support to stout's Path.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/stout/path.hpp ba1f665ce94b9636d88a7ecce8643c56758f7b5c 
>   3rdparty/stout/tests/path_tests.cpp 19dd910a534040468aeb48f15ebdf56dff32bc15 
> 
> 
> Diff: https://reviews.apache.org/r/71878/diff/1/
> 
> 
> Testing
> -------
> 
> `make check`
> 
> 
> Thanks,
> 
> Benjamin Bannier
> 
>