> 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 > >
