mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam B <a...@mesosphere.io>
Subject Re: Review Request 47805: Add authorization to GET /weights.
Date Sat, 28 May 2016 05:53:34 GMT


> On May 27, 2016, 2:39 a.m., Adam B wrote:
> > src/tests/dynamic_weights_tests.cpp, line 88
> > <https://reviews.apache.org/r/47805/diff/2/?file=1396132#file1396132line88>
> >
> >     Neat trick, but I think we're better off just specifying DEFAULT_CREDENTIAL
at those call sites
> 
> zhou xing wrote:
>     Adam, not very clear on your suggestions, do you mean that we just put credential
= DEFAULT_CREDENTIAL here? but as a macro, it is not allowed to put an expression in this
file scope, thanks for your time on looking this.
> 
> zhou xing wrote:
>     or do you mean change all the caller side to add the credential param and remove
the param default value here?

The latter suggestion exactly. Remove the parameter's default value `= []{ return DEFAULT_CREDENTIAL;
}()` altogether, and whatever callsites previously relied on the default param, you can just
pass `DEFAULT_CREDENTIAL` instead.


> On May 27, 2016, 2:39 a.m., Adam B wrote:
> > src/master/weights_handler.cpp, line 85
> > <https://reviews.apache.org/r/47805/diff/2/?file=1396131#file1396131line85>
> >
> >     Technically, this lambda should be indented to align with its fellow defer()
parameter `master->self()`, or (since that looks too jagged) just indented 4 spaces in
from the `.then`.
> >     Looks like our convention for the `-> Future` after is 2 spaces in from the
`[=]` like you have.
> 
> zhou xing wrote:
>     Thanks for the comments! The indention is a little confusion to me, as somewhere
in the code is 4 spaces indention while other places are 2 spaces, do we have any regulation
on the indention?

http://mesos.apache.org/documentation/latest/c++-style-guide/ lists our exceptions to the
Google style guide at https://google.github.io/styleguide/cppguide.html (I just noticed the
google style link on our site is broken; fixing now).
General rules I follow:
Use 2 spaces when
- Beginning the inside of a function/loop/condition or other thing scoped with `{`
- Continuing a line of code after wrapping on `=`
Wrap to the same indentation as the previous parameter
- When doing so won't make the code look "jagged"
Use 4 spaces when
- Continuing a line of code otherwise
When in doubt, grep away. When there are conflicts, count (perhaps scoped to the same file/folder)
to see who wins. 
If you're still not sure, git blame to see which committer's opinion you trust more. :)
In this case, the decision wasn't clear to me, so I grepped and blamed.
I'm not personally style-opinionated, but I do like consistency.


- Adam


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


On May 26, 2016, 10:45 p.m., zhou xing wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/47805/
> -----------------------------------------------------------
> 
> (Updated May 26, 2016, 10:45 p.m.)
> 
> 
> Review request for mesos and Adam B.
> 
> 
> Bugs: mesos-5335
>     https://issues.apache.org/jira/browse/mesos-5335
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Add 'GET_WEIGHTS_WITH_ROLE' for the authorization of GET /weights.
> 
> 
> Diffs
> -----
> 
>   docs/endpoints/master/weights.md 1e540795c5fb90c8ea957dd444b9e564e0b1ac23 
>   include/mesos/authorizer/acls.proto ace9b698f46e1437911115c82324a87a0d7827fb 
>   include/mesos/authorizer/authorizer.proto 02d1a01d57cf34b38524f4368187878b03343537

>   src/authorizer/local/authorizer.cpp 3c7c791bde65cfcbcc4e319c9ccc487ab37d8029 
>   src/master/http.cpp b36b439a1fa07c52146deff2b90728f92676ade3 
>   src/master/master.hpp 1a875c32eddfb6d884e3d0dda7f5716ee53966c3 
>   src/master/weights_handler.cpp 4bc060fdb015df6658194eef92fe11b14aa15c79 
>   src/tests/dynamic_weights_tests.cpp 362c59aae7b305710d5985bfec28f881be3b64b8 
> 
> Diff: https://reviews.apache.org/r/47805/diff/
> 
> 
> Testing
> -------
> 
> make
> make check
> 
> 
> Thanks,
> 
> zhou xing
> 
>


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