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 2017/10/09 12:13:09 UTC
Review Request 62842: Fixed 'operator==' for
'v1::Resource::DiskInfo::Source'.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/62842/
-----------------------------------------------------------
Review request for mesos, Jie Yu and Jan Schlicht.
Repository: mesos
Description
-------
When implementing 'operator==' for protobufs as a pattern we typically
first check that two 'optional' fields are set for both the left- and
right-hand side, and only then compare their values, e.g., given a
definition
message Foo {
optional string bar = 1;
}
we would implement 'operator==' similar to the following,
bool operator==(const Foo& lhs, const Foo& rhs)
{
if (lhs.has_bar() != rhs.has_bar()) {
return false;
}
if (lhs.has_bar() && lhs.bar() != rhs.bar()) {
return false;
}
return true;
}
One reason for this is that it allows us to distinguish an unset field
from a set field containing a default constructed value (if e.g.,
above 'lhs.has_bar()' was 'false', 'lhs.bar()' would return an empty
string).
This patch makes sure we use the same pattern when checking
'v1::Resource::DiskInfo::Source' for equality. An earlier patch
('591f74d') already fixed this for 'Resources::DiskInfo::Source'.
Diffs
-----
src/v1/resources.cpp a64180bad1d782dd270e06217a389002155c2e10
Diff: https://reviews.apache.org/r/62842/diff/1/
Testing
-------
`make check`
Thanks,
Benjamin Bannier
Re: Review Request 62842: Fixed 'operator==' for
'v1::Resource::DiskInfo::Source'.
Posted by Mesos Reviewbot Windows <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/62842/#review187429
-----------------------------------------------------------
PASS: Mesos patch 62842 was successfully built and tested.
Reviews applied: `['62842']`
All the build artifacts available at: http://dcos-win.westus.cloudapp.azure.com/mesos-build/review/62842
- Mesos Reviewbot Windows
On Oct. 9, 2017, 12:13 p.m., Benjamin Bannier wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/62842/
> -----------------------------------------------------------
>
> (Updated Oct. 9, 2017, 12:13 p.m.)
>
>
> Review request for mesos, Jie Yu and Jan Schlicht.
>
>
> Repository: mesos
>
>
> Description
> -------
>
> When implementing 'operator==' for protobufs as a pattern we typically
> first check that two 'optional' fields are set for both the left- and
> right-hand side, and only then compare their values, e.g., given a
> definition
>
> message Foo {
> optional string bar = 1;
> }
>
> we would implement 'operator==' similar to the following,
>
> bool operator==(const Foo& lhs, const Foo& rhs)
> {
> if (lhs.has_bar() != rhs.has_bar()) {
> return false;
> }
>
> if (lhs.has_bar() && lhs.bar() != rhs.bar()) {
> return false;
> }
>
> return true;
> }
>
> One reason for this is that it allows us to distinguish an unset field
> from a set field containing a default constructed value (if e.g.,
> above 'lhs.has_bar()' was 'false', 'lhs.bar()' would return an empty
> string).
>
> This patch makes sure we use the same pattern when checking
> 'v1::Resource::DiskInfo::Source' for equality. An earlier patch
> ('591f74d') already fixed this for 'Resources::DiskInfo::Source'.
>
>
> Diffs
> -----
>
> src/v1/resources.cpp a64180bad1d782dd270e06217a389002155c2e10
>
>
> Diff: https://reviews.apache.org/r/62842/diff/1/
>
>
> Testing
> -------
>
> `make check`
>
>
> Thanks,
>
> Benjamin Bannier
>
>
Re: Review Request 62842: Fixed 'operator==' for
'v1::Resource::DiskInfo::Source'.
Posted by Jan Schlicht <ja...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/62842/#review187401
-----------------------------------------------------------
Ship it!
Ship It!
- Jan Schlicht
On Oct. 9, 2017, 2:13 p.m., Benjamin Bannier wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/62842/
> -----------------------------------------------------------
>
> (Updated Oct. 9, 2017, 2:13 p.m.)
>
>
> Review request for mesos, Jie Yu and Jan Schlicht.
>
>
> Repository: mesos
>
>
> Description
> -------
>
> When implementing 'operator==' for protobufs as a pattern we typically
> first check that two 'optional' fields are set for both the left- and
> right-hand side, and only then compare their values, e.g., given a
> definition
>
> message Foo {
> optional string bar = 1;
> }
>
> we would implement 'operator==' similar to the following,
>
> bool operator==(const Foo& lhs, const Foo& rhs)
> {
> if (lhs.has_bar() != rhs.has_bar()) {
> return false;
> }
>
> if (lhs.has_bar() && lhs.bar() != rhs.bar()) {
> return false;
> }
>
> return true;
> }
>
> One reason for this is that it allows us to distinguish an unset field
> from a set field containing a default constructed value (if e.g.,
> above 'lhs.has_bar()' was 'false', 'lhs.bar()' would return an empty
> string).
>
> This patch makes sure we use the same pattern when checking
> 'v1::Resource::DiskInfo::Source' for equality. An earlier patch
> ('591f74d') already fixed this for 'Resources::DiskInfo::Source'.
>
>
> Diffs
> -----
>
> src/v1/resources.cpp a64180bad1d782dd270e06217a389002155c2e10
>
>
> Diff: https://reviews.apache.org/r/62842/diff/1/
>
>
> Testing
> -------
>
> `make check`
>
>
> Thanks,
>
> Benjamin Bannier
>
>
Re: Review Request 62842: Fixed 'operator==' for
'v1::Resource::DiskInfo::Source'.
Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/62842/#review187427
-----------------------------------------------------------
Ship it!
Ah, I have a patch in my chain. I'll discard mine/
- Jie Yu
On Oct. 9, 2017, 12:13 p.m., Benjamin Bannier wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/62842/
> -----------------------------------------------------------
>
> (Updated Oct. 9, 2017, 12:13 p.m.)
>
>
> Review request for mesos, Jie Yu and Jan Schlicht.
>
>
> Repository: mesos
>
>
> Description
> -------
>
> When implementing 'operator==' for protobufs as a pattern we typically
> first check that two 'optional' fields are set for both the left- and
> right-hand side, and only then compare their values, e.g., given a
> definition
>
> message Foo {
> optional string bar = 1;
> }
>
> we would implement 'operator==' similar to the following,
>
> bool operator==(const Foo& lhs, const Foo& rhs)
> {
> if (lhs.has_bar() != rhs.has_bar()) {
> return false;
> }
>
> if (lhs.has_bar() && lhs.bar() != rhs.bar()) {
> return false;
> }
>
> return true;
> }
>
> One reason for this is that it allows us to distinguish an unset field
> from a set field containing a default constructed value (if e.g.,
> above 'lhs.has_bar()' was 'false', 'lhs.bar()' would return an empty
> string).
>
> This patch makes sure we use the same pattern when checking
> 'v1::Resource::DiskInfo::Source' for equality. An earlier patch
> ('591f74d') already fixed this for 'Resources::DiskInfo::Source'.
>
>
> Diffs
> -----
>
> src/v1/resources.cpp a64180bad1d782dd270e06217a389002155c2e10
>
>
> Diff: https://reviews.apache.org/r/62842/diff/1/
>
>
> Testing
> -------
>
> `make check`
>
>
> Thanks,
>
> Benjamin Bannier
>
>