MCPcopy Create free account
hub / github.com/apache/mesos / call

Method call

src/scheduler/scheduler.cpp:254–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252 }
253
254 Future<APIResult> call(const Call& callMessage)
255 {
256 Option<Error> error =
257 validation::scheduler::call::validate(devolve(callMessage));
258
259 if (error.isSome()) {
260 return Failure(error->message);
261 }
262
263 if (callMessage.type() == Call::SUBSCRIBE) {
264 return Failure("This method doesn't support SUBSCRIBE calls");
265 }
266
267 if (state != SUBSCRIBED) {
268 return Failure(
269 "Cannot perform calls until subscribed. Current state: " +
270 stringify(state));
271 }
272
273 VLOG(1) << "Sending " << callMessage.type() << " call to " << master.get();
274
275 // TODO(vinod): Add support for sending MESSAGE calls directly
276 // to the slave, instead of relaying it through the master, as
277 // the scheduler driver does.
278
279 process::http::Request request;
280 request.method = "POST";
281 request.url = master.get();
282 request.body = serialize(contentType, callMessage);
283 request.keepAlive = true;
284 request.headers = {{"Accept", stringify(contentType)},
285 {"Content-Type", stringify(contentType)}};
286
287 // TODO(tillt): Add support for multi-step authentication protocols.
288 return authenticatee->authenticate(request, credential)
289 .recover([](const Future<process::http::Request>& future) {
290 return Failure(
291 stringify("HTTP authenticatee ") +
292 (future.isFailed() ? "failed: " + future.failure() : "discarded"));
293 })
294 .then(defer(self(), &Self::_call, callMessage, lambda::_1));
295 }
296
297 void reconnect()
298 {

Callers

nothing calls this directly

Calls 14

FailureClass · 0.85
deferFunction · 0.85
typeMethod · 0.80
isFailedMethod · 0.80
failureMethod · 0.80
validateFunction · 0.50
devolveFunction · 0.50
stringifyFunction · 0.50
serializeFunction · 0.50
isSomeMethod · 0.45
getMethod · 0.45
thenMethod · 0.45

Tested by

no test coverage detected