> On 八月 25, 2016, 12:32 a.m., Kevin Klues wrote:
> > src/docker/docker.hpp, lines 73-84
> > <https://reviews.apache.org/r/50128/diff/8/?file=1480596#file1480596line73>
> >
> >     In general, we don't typically have constructors for `structs` like 
> > this. Instead, we just set its fields directly at the call site.
> >     
> >     If you see the comment below about making the `Device::parse()` 
> > function static, then you could (in theory) always build the device from 
> > that instead of calling the constructor directly, i.e.:
> >     
> >     ```
> >     Try<Device> device = Device::parse(deviceString);
> >     ```
> >     
> >     
> >     Device device;
> >     device.hostPath = host;
> >     device.containerPath = container;
> >     device.access = ;
> >     ```

Removed constructors and added two `Device::parse()` functions:
```
static Try<Device> parse(
       const std::string& host,
       const std::string& container,
       const std::string& permissions)

static Try<Device> parse(const std::string& devices)
```


> On 八月 25, 2016, 12:32 a.m., Kevin Klues wrote:
> > src/docker/docker.hpp, lines 86-95
> > <https://reviews.apache.org/r/50128/diff/8/?file=1480596#file1480596line86>
> >
> >     I woudn't implement a `serialize()` function directly, but rather 
> > overload the `<<` operator. That way you can just run the global 
> > `stringify()` function to turn it into a string.

removed `serialize()` and overloaded `<<` operator.


> On 八月 25, 2016, 12:32 a.m., Kevin Klues wrote:
> > src/docker/docker.hpp, line 97
> > <https://reviews.apache.org/r/50128/diff/8/?file=1480596#file1480596line97>
> >
> >     This should probably be a static function, not a member function. It 
> > should also return a `Try<Device>`, not a `bool`.
> >     
> >     See how things are done in for device entries in `src/linux/cgroups.*pp`

changed `parse()` function to:
```
    static Try<Device> parse(
        const std::string& host,
        const std::string& container,
        const std::string& permissions)
```


- Yubo


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


On 八月 22, 2016, 10:11 a.m., Yubo Li wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/50128/
> -----------------------------------------------------------
> 
> (Updated 八月 22, 2016, 10:11 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Kevin Klues, and Rajat Phull.
> 
> 
> Bugs: MESOS-5795
>     https://issues.apache.org/jira/browse/MESOS-5795
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Wrapped helper functions 'serialize()' and 'parse()' to 'Docker::Device'
> to handle data tranformation between 'Docker::Device' structure and
> string.
> 
> 
> Diffs
> -----
> 
>   src/docker/docker.hpp 9093371afc8ea792ba94f61c6875703e547ea6b0 
>   src/docker/docker.cpp e07c4aa723f57db7f8bc31d4af5d32a30ebf98f2 
> 
> Diff: https://reviews.apache.org/r/50128/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Yubo Li
> 
>

Reply via email to