----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/52002/#review149739 -----------------------------------------------------------
include/mesos/resources.hpp (lines 273 - 274) <https://reviews.apache.org/r/52002/#comment217421> Does it need to be a Try? i.e., if it's not a disk, it's not a root disk, right? We have `validate()` to make sure resources are valid. include/mesos/resources.hpp (lines 276 - 278) <https://reviews.apache.org/r/52002/#comment217422> Would it be simpler to just have ``` static bool Resources::isMountDisk(const Resource& resource); static bool Resources::isPathDisk(const Resource& resource); ``` ? We have already lost enumerability (or swtichability) given that the root disk does not have a type. :) src/common/resources.cpp (line 920) <https://reviews.apache.org/r/52002/#comment217425> Not `!resource.has_disk()` but rather `!resource.disk().has_source()` right? See examples below. src/common/resources.cpp (lines 924 - 943) <https://reviews.apache.org/r/52002/#comment217424> It seems to be cleaner to implement the following instead: ``` static bool Resources::isMountDisk(const Resource& resource) { return resource.has_disk() && resource.disk().has_source() && resource.disk().source().type() == Resource::DiskInfo::Source::MOUNT; } static bool Resources::isPathDisk(const Resource& resource) { return resource.has_disk() && resource.disk().has_source() && resource.disk().source().type() == Resource::DiskInfo::Source::PATH; } ``` - Jiang Yan Xu On Sept. 19, 2016, 3:43 p.m., Anindya Sinha wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/52002/ > ----------------------------------------------------------- > > (Updated Sept. 19, 2016, 3:43 p.m.) > > > Review request for mesos and Jiang Yan Xu. > > > Bugs: MESOS-6062 > https://issues.apache.org/jira/browse/MESOS-6062 > > > Repository: mesos > > > Description > ------- > > Added helper methods to determine types of disk resources. > > > Diffs > ----- > > include/mesos/resources.hpp 3ef8cacee529addc745b4aeb6398d7606c61b749 > include/mesos/v1/resources.hpp ef56b4960b103a3efd916fab64796aa334ba44c6 > src/common/resources.cpp 4602bff22ec7ff77f069056085ad92bfa04595f3 > src/tests/resources_tests.cpp 3e493007d6d1d8194d07035aaa1cde28dedf2b5a > src/v1/resources.cpp 7c4db44d4c31a8295cc16b0ce1ef5adf314e6ac6 > > Diff: https://reviews.apache.org/r/52002/diff/ > > > Testing > ------- > > > Thanks, > > Anindya Sinha > >