You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Alexander Rukletsov <ru...@gmail.com> on 2015/12/02 16:47:17 UTC
Re: Review Request 40347: [3/4] Quota Authorization: Implemented quota
request authorization.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/40347/#review108645
-----------------------------------------------------------
include/mesos/quota/quota.proto (lines 43 - 45)
<https://reviews.apache.org/r/40347/#comment168103>
Do you think `principal` should be required? Does it mean quota cannot be requested without providing `Authorization` header? I think you do so in `authorize()` below.
I think it's also fine to prohibit setting quota without prinicipal, but let's be consitent and explicit about it.
src/master/master.hpp (lines 899 - 900)
<https://reviews.apache.org/r/40347/#comment168105>
Do you need the whole `QuotaInfo` or optional `principal` and role would suffice?
src/master/quota_handler.cpp (line 82)
<https://reviews.apache.org/r/40347/#comment168099>
Do we need `Credential` here or principal would suffice?
src/master/quota_handler.cpp (lines 94 - 96)
<https://reviews.apache.org/r/40347/#comment168100>
I think this may be buggy: `principal` is required, however we do not ensure it is present here, means we may create a protbuf message, that we cannot deserialize.
src/master/quota_handler.cpp (lines 236 - 240)
<https://reviews.apache.org/r/40347/#comment168110>
Can we re-write it using a lambda? This way you do not need to inject `authorized` into the continuation.
```
authorize(quotaInfo)
.then(defer(master->self(), [=](bool authorized) -> Future<Response> {
if (!authorized) {
return Unauthorized("Mesos master");
}
_set(quotaInfo);
}));
```
src/master/quota_handler.cpp (lines 333 - 334)
<https://reviews.apache.org/r/40347/#comment168111>
Blank line?
src/master/quota_handler.cpp (lines 338 - 339)
<https://reviews.apache.org/r/40347/#comment168112>
Blank line?
src/master/quota_handler.cpp (lines 339 - 340)
<https://reviews.apache.org/r/40347/#comment168113>
Let's wrap variable and function names in backticks.
Also, how about re-wording it a bit for brevity? Something like "`quotaInfo` is already validated, role is quaranteed to be present".
- Alexander Rukletsov
On Nov. 20, 2015, 10:03 a.m., Jan Schlicht wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/40347/
> -----------------------------------------------------------
>
> (Updated Nov. 20, 2015, 10:03 a.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Alexander Rojas, Joris Van Remoortere, and Till Toenshoff.
>
>
> Bugs: MESOS-3862
> https://issues.apache.org/jira/browse/MESOS-3862
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Quota: Implemented quota request authorization.
>
>
> Diffs
> -----
>
> include/mesos/quota/quota.proto 4e4d8ccc92e2bf9a8e5eae8488c0c952f82fdd6d
> src/master/master.hpp 5e5a575dc7dd49324f3c837028df8a7f75cd1f80
> src/master/quota_handler.cpp 03cef4117c52da7599a2800060f65483ca33bc3f
>
> Diff: https://reviews.apache.org/r/40347/diff/
>
>
> Testing
> -------
>
> make check
>
>
> Thanks,
>
> Jan Schlicht
>
>
Re: Review Request 40347: [3/4] Quota Authorization: Implemented quota
request authorization.
Posted by Jan Schlicht <ja...@mesosphere.io>.
> On Dec. 2, 2015, 4:47 p.m., Alexander Rukletsov wrote:
> > src/master/quota_handler.cpp, lines 236-240
> > <https://reviews.apache.org/r/40347/diff/5/?file=1134158#file1134158line236>
> >
> > Can we re-write it using a lambda? This way you do not need to inject `authorized` into the continuation.
> >
> > ```
> > authorize(quotaInfo)
> > .then(defer(master->self(), [=](bool authorized) -> Future<Response> {
> > if (!authorized) {
> > return Unauthorized("Mesos master");
> > }
> >
> > _set(quotaInfo);
> > }));
> > ```
Sure, but the rest of the function already has a similar lamdba continuation (i.e. will have after rebasing). This will result in a lambda inside a lambda which is too much nesting IMHO. Therefore I would prefer to keep the continuation.
> On Dec. 2, 2015, 4:47 p.m., Alexander Rukletsov wrote:
> > include/mesos/quota/quota.proto, lines 43-45
> > <https://reviews.apache.org/r/40347/diff/5/?file=1134156#file1134156line43>
> >
> > Do you think `principal` should be required? Does it mean quota cannot be requested without providing `Authorization` header? I think you do so in `authorize()` below.
> >
> > I think it's also fine to prohibit setting quota without prinicipal, but let's be consitent and explicit about it.
Actually, after refactoring `principal` can be removed here. It will be needed when the `remove quota` is implemented and will be implemented there.
> On Dec. 2, 2015, 4:47 p.m., Alexander Rukletsov wrote:
> > src/master/quota_handler.cpp, lines 94-96
> > <https://reviews.apache.org/r/40347/diff/5/?file=1134158#file1134158line94>
> >
> > I think this may be buggy: `principal` is required, however we do not ensure it is present here, means we may create a protbuf message, that we cannot deserialize.
The `principal` field will be removed and implemented later for `remove quota`.
- Jan
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/40347/#review108645
-----------------------------------------------------------
On Dec. 7, 2015, 2:03 p.m., Jan Schlicht wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/40347/
> -----------------------------------------------------------
>
> (Updated Dec. 7, 2015, 2:03 p.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Alexander Rojas, Joris Van Remoortere, and Till Toenshoff.
>
>
> Bugs: MESOS-3862
> https://issues.apache.org/jira/browse/MESOS-3862
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Quota: Implemented quota request authorization.
>
>
> Diffs
> -----
>
> src/master/master.hpp 4683fa542a740f9a0b80fff7fbe0e63ec66266f2
> src/master/quota_handler.cpp b209da42ace752953686eeda9577007a33556d5d
>
> Diff: https://reviews.apache.org/r/40347/diff/
>
>
> Testing
> -------
>
> make check
>
>
> Thanks,
>
> Jan Schlicht
>
>
Re: Review Request 40347: [3/4] Quota Authorization: Implemented quota
request authorization.
Posted by Jan Schlicht <ja...@mesosphere.io>.
> On Dec. 2, 2015, 4:47 p.m., Alexander Rukletsov wrote:
> > src/master/quota_handler.cpp, lines 236-240
> > <https://reviews.apache.org/r/40347/diff/5/?file=1134158#file1134158line236>
> >
> > Can we re-write it using a lambda? This way you do not need to inject `authorized` into the continuation.
> >
> > ```
> > authorize(quotaInfo)
> > .then(defer(master->self(), [=](bool authorized) -> Future<Response> {
> > if (!authorized) {
> > return Unauthorized("Mesos master");
> > }
> >
> > _set(quotaInfo);
> > }));
> > ```
>
> Jan Schlicht wrote:
> Sure, but the rest of the function already has a similar lamdba continuation (i.e. will have after rebasing). This will result in a lambda inside a lambda which is too much nesting IMHO. Therefore I would prefer to keep the continuation.
Oh, sorry, I skipped your example code. Thought that I ought to put everything into a lambda and remove the continuation completly. Yes, using the lambda this way makes much more sense, will implement it that way.
- Jan
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/40347/#review108645
-----------------------------------------------------------
On Dec. 7, 2015, 2:03 p.m., Jan Schlicht wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/40347/
> -----------------------------------------------------------
>
> (Updated Dec. 7, 2015, 2:03 p.m.)
>
>
> Review request for mesos, Alexander Rukletsov, Alexander Rojas, Joris Van Remoortere, and Till Toenshoff.
>
>
> Bugs: MESOS-3862
> https://issues.apache.org/jira/browse/MESOS-3862
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Quota: Implemented quota request authorization.
>
>
> Diffs
> -----
>
> src/master/master.hpp 4683fa542a740f9a0b80fff7fbe0e63ec66266f2
> src/master/quota_handler.cpp b209da42ace752953686eeda9577007a33556d5d
>
> Diff: https://reviews.apache.org/r/40347/diff/
>
>
> Testing
> -------
>
> make check
>
>
> Thanks,
>
> Jan Schlicht
>
>