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

Function validateExecutorCall

src/common/validation.cpp:538–642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

536}
537
538Option<Error> validateExecutorCall(const mesos::executor::Call& call)
539{
540 if (!call.IsInitialized()) {
541 return Error("Not initialized: " + call.InitializationErrorString());
542 }
543
544 if (!call.has_type()) {
545 return Error("Expecting 'type' to be present");
546 }
547
548 // All calls should have executor id set.
549 if (!call.has_executor_id()) {
550 return Error("Expecting 'executor_id' to be present");
551 }
552
553 // All calls should have framework id set.
554 if (!call.has_framework_id()) {
555 return Error("Expecting 'framework_id' to be present");
556 }
557
558 switch (call.type()) {
559 case mesos::executor::Call::SUBSCRIBE: {
560 if (!call.has_subscribe()) {
561 return Error("Expecting 'subscribe' to be present");
562 }
563 return None();
564 }
565
566 case mesos::executor::Call::UPDATE: {
567 if (!call.has_update()) {
568 return Error("Expecting 'update' to be present");
569 }
570
571 const TaskStatus& status = call.update().status();
572
573 if (!status.has_uuid()) {
574 return Error("Expecting 'uuid' to be present");
575 }
576
577 Try<id::UUID> uuid = id::UUID::fromBytes(status.uuid());
578 if (uuid.isError()) {
579 return uuid.error();
580 }
581
582 if (status.has_executor_id() &&
583 status.executor_id().value()
584 != call.executor_id().value()) {
585 return Error("ExecutorID in Call: " +
586 call.executor_id().value() +
587 " does not match ExecutorID in TaskStatus: " +
588 call.update().status().executor_id().value()
589 );
590 }
591
592 if (status.source() != TaskStatus::SOURCE_EXECUTOR) {
593 return Error("Received Call from executor " +
594 call.executor_id().value() +
595 " of framework " +

Callers 2

sendMethod · 0.85
executorMethod · 0.85

Calls 13

NoneClass · 0.85
validateCheckStatusInfoFunction · 0.85
IsInitializedMethod · 0.80
typeMethod · 0.80
errorMethod · 0.65
ErrorFunction · 0.50
statusMethod · 0.45
updateMethod · 0.45
isErrorMethod · 0.45
valueMethod · 0.45
stateMethod · 0.45
isSomeMethod · 0.45

Tested by

no test coverage detected