MCPcopy Create free account
hub / github.com/3rdparty/libprocess / __processes__

Method __processes__

src/process.cpp:3438–3481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3436
3437
3438Future<Response> ProcessManager::__processes__(const Request& request)
3439{
3440 synchronized (processes_mutex) {
3441 return collect(lambda::map(
3442 [](ProcessBase* process) {
3443 // TODO(benh): Try and "inject" this dispatch or create a
3444 // high-priority set of events (i.e., mailbox).
3445 return dispatch(
3446 process->self(),
3447 [process]() -> Option<JSON::Object> {
3448 return Option<JSON::Object>(*process);
3449 })
3450 // We must recover abandoned futures in case
3451 // the process is terminated and the dispatch
3452 // is dropped.
3453 .recover([](const Future<Option<JSON::Object>>& f) {
3454 return Option<JSON::Object>::none();
3455 });
3456 },
3457 process_manager->processes.values()))
3458 .then([request](
3459 const std::vector<Option<JSON::Object>>& objects) -> Response {
3460 JSON::Array array;
3461 foreach (const Option<JSON::Object>& object, objects) {
3462 if (object.isSome()) {
3463 array.values.push_back(*object);
3464 }
3465 }
3466
3467 Response response = OK(array);
3468
3469 // TODO(alexr): Generalize response logging in libprocess.
3470 VLOG(1) << "HTTP " << request.method << " for " << request.url
3471 << (request.client.isSome()
3472 ? " from " + stringify(request.client.get())
3473 : "")
3474 << ": '" << response.status << "'"
3475 << " after " << (process::Clock::now() - request.received).ms()
3476 << Milliseconds::units();
3477
3478 return response;
3479 });
3480 }
3481}
3482
3483
3484ProcessBase::ProcessBase(const string& id)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected