mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [mesos] kaysoky commented on a change in pull request #326: MESOS-6874: Validate the match between Type and *Infos in the ContainerInfo.
Date Mon, 11 Mar 2019 19:19:09 GMT
kaysoky commented on a change in pull request #326: MESOS-6874: Validate the match between
Type and *Infos in the ContainerInfo.
URL: https://github.com/apache/mesos/pull/326#discussion_r264382919
 
 

 ##########
 File path: src/slave/containerizer/composing.cpp
 ##########
 @@ -425,6 +425,28 @@ Future<Containerizer::LaunchResult> ComposingContainerizerProcess::_launch(
 }
 
 
+static Try<Nothing> validateContainerInfoType(const ContainerInfo& info)
 
 Review comment:
   We use this "protobuf union" trick in tons of different protobufs, like the `CheckInfo`,
`HealthCheck`, `ExecutorInfo`, `Value`, `Resource::DiskInfo::Source`, `Offer::Operation`,
`Environment::Variable`, `Secret`, `Image`, `Volume::Source`, and `ContainerInfo`.
   
   I wonder if it would be helpful to make this a templated helper function in `src/common/protobuf_utils.hpp`.
 Something like this (which I have not tried):
   ```
   template <typename Info>
   static Try<Nothing> validateProtobufUnion(const Info& info) 
   {
     const auto* typeDescriptor = Info::Type_descriptor();
     const auto* infoDescriptor = Info::descriptor();
     ...
   }
   ```
   With usage like:
   ```
   CHECK_SOME(validateProtobufUnion<ContainerInfo>(info));
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message