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

Function foreach

src/common/resources.cpp:581–605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579 hashmap<string, Value::Type> nameTypes;
580
581 foreach (const Resource& resource, resources) {
582 // These fields should only be provided programmatically,
583 // not at the command line.
584 if (Resources::isPersistentVolume(resource)) {
585 return Error(
586 "Persistent volumes cannot be specified at the command line");
587 } else if (Resources::isRevocable(resource)) {
588 return Error(
589 "Revocable resources cannot be specified at the command line; do"
590 " not include a 'revocable' key in the resources JSON");
591 } else if (Resources::isDynamicallyReserved(resource)) {
592 return Error(
593 "Dynamic reservations cannot be specified at the command line; do"
594 " not include a reservation with DYNAMIC type in the resources JSON");
595 }
596
597 if (nameTypes.contains(resource.name()) &&
598 nameTypes[resource.name()] != resource.type()) {
599 return Error(
600 "Resources with the same name ('" + resource.name() + "') but"
601 " different types are not allowed");
602 } else if (!nameTypes.contains(resource.name())) {
603 nameTypes[resource.name()] = resource.type();
604 }
605 }
606
607 return None();
608}

Callers 1

fromJSONMethod · 0.70

Calls 15

tokenizeFunction · 0.85
trimFunction · 0.85
upgradeResourceFunction · 0.85
findFunction · 0.85
NoneClass · 0.85
compareResourceMetadataFunction · 0.85
typeMethod · 0.80
CopyFromMethod · 0.80
insertMethod · 0.80
validateFunction · 0.70
parseFunction · 0.70
addableFunction · 0.70

Tested by

no test coverage detected