mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Park" <mcyp...@gmail.com>
Subject Re: Review Request 32150: Enabled the master to handle reservation operations.
Date Thu, 30 Apr 2015 02:03:28 GMT


> On April 29, 2015, 10:15 p.m., Jie Yu wrote:
> > src/master/master.cpp, lines 2487-2492
> > <https://reviews.apache.org/r/32150/diff/8/?file=944522#file944522line2487>
> >
> >     Why use a tmp variable here? Could you combine with validation below:
> >     ```
> >     Option<Error> error = validation::operation::validate(
> >         operation.reserve(),
> >         framework->info.role(),
> >         (framework->info.has_principal() ?
> >            framework->info.principal() :
> >            Option<string>::none()));
> >     ```

I looked at that style and thought people would find it hard to read. But I can change it
:)


> On April 29, 2015, 10:15 p.m., Jie Yu wrote:
> > src/master/validation.cpp, line 598
> > <https://reviews.apache.org/r/32150/diff/8/?file=944524#file944524line598>
> >
> >     No snake_case please:)
> >     
> >     Also, instead of using a boolean, can you pass an Option<string> principal
as you did in `validate(reserve)`?

> No snake_case please:)

Grr... the `snake_case` thing keeps getting me. I'll find a way to prevent myself from it
and meanwhile be more attentive about it.

> Also, instead of using a boolean, can you pass an Option<string> principal as you
did in validate(reserve)?

I considered that as well to keep "consistent", but decided that (1) we don't pass `role`
so we're not really consistent anyway, and (2) we'd be passing more information than we need
while hindering readability at the callsite:

```
Option<Error> error = validation::operation::validate(
    operation.unreserve(),
    (framework->info.has_principal() ?
       framework->info.principal() :
       Option<string>::none()));       
```
       
as well as within the function: "we pass an `Option<string>` but ever only perform presence
tests on it via `isSome`, `isNone`, are we missing some logic?".

I guess is that you have/had similar thoughts, but do you perhaps have strong reasons you
would recommend passing `Option<string>` here?


- Michael


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


On April 28, 2015, 10:43 p.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/32150/
> -----------------------------------------------------------
> 
> (Updated April 28, 2015, 10:43 p.m.)
> 
> 
> Review request for mesos, Alexander Rukletsov, Ben Mahler, and Jie Yu.
> 
> 
> Bugs: MESOS-2139
>     https://issues.apache.org/jira/browse/MESOS-2139
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Handled reservation operations in `Master::_accept`.
> 
> Added `validate` functions in `src/master/validation.{hpp,cpp}`.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp d42a6f321c88ec5d0418264bdda39d083ff54a7e 
>   src/master/validation.hpp 2d7416c053f82d6316542fa9c35b0e7bc605abec 
>   src/master/validation.cpp dc25995bf57397d42fcde458414f0402d19bf792 
>   src/tests/master_validation_tests.cpp 4f2ad58c3ae0f611fb476c4d91a37dd6a5541395 
> 
> Diff: https://reviews.apache.org/r/32150/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Michael Park
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message