> On 六月 28, 2016, 6:14 a.m., Vinod Kone wrote:
> > src/master/http.cpp, line 1358
> > <https://reviews.apache.org/r/49137/diff/5/?file=1431412#file1431412line1358>
> >
> > don't use `auto` here because the type is not clear from this
> > expression.
>
> zhou xing wrote:
> If I reaplace auto with hashmap<ExecutorID, ExecutorInfo>, I got the
> following compile error:
>
> '''
> ../../src/master/http.cpp:1274:16: error: too many arguments provided to
> function-like macro invocation
> framework.executors) {
> ^
> ../../3rdparty/stout/include/stout/foreach.hpp:51:9: note: macro
> 'foreachpair'
> defined here
> #define foreachpair(KEY, VALUE, ELEMS)
> '''
>
> I checked the code of foreachpair, seems it does not accept more than 1
> template params?
another solution I can see is to use the following code to go through all the
executors:
```
const hashset<SlaveID>& slaveIds = framework.executors.keys();
foreach (const SlaveID& slaveId, slaveIds) {
const hashmap<ExecutorID, ExecutorInfo>& executorsMap =
framework.executors.get(slaveId).get();
foreachvalue (const ExecutorInfo& info, executorsMap) {
// Skip unauthorized executors.
if (!approveViewExecutorInfo(executorsApprover,
info,
framework.info)) {
continue;
}
mesos::master::Response::GetFrameworks::Executor executor;
executor.mutable_info()->CopyFrom(executor);
executor.mutable_agent_id()->set_value(slaveId.value());
_framework.mutable_executors()->Add()->CopyFrom(executor);
}
}
```
I prefer to keep 'auto', as it is not that complex. What do you think?
- zhou
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/49137/#review139729
-----------------------------------------------------------
On 六月 28, 2016, 3:11 a.m., zhou xing wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/49137/
> -----------------------------------------------------------
>
> (Updated 六月 28, 2016, 3:11 a.m.)
>
>
> Review request for mesos, Anand Mazumdar, haosdent huang, and Vinod Kone.
>
>
> Bugs: mesos-5492
> https://issues.apache.org/jira/browse/mesos-5492
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Implemented getFrameworks method in http.cpp.
>
>
> Diffs
> -----
>
> src/master/http.cpp 9e6d291aff77bb39462375dfed5dc75f3719806f
> src/master/master.hpp f16bccd0b72a8785d03290d11cd9b28d2990fd24
> src/tests/api_tests.cpp 7eb179f300f7a7dc6bdc3425268e7cd2fc8299fe
>
> Diff: https://reviews.apache.org/r/49137/diff/
>
>
> Testing
> -------
>
> make
> make check
>
>
> Thanks,
>
> zhou xing
>
>