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

Function foreach

src/v1/resources.cpp:574–598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

fromJSONMethod · 0.70

Calls 15

tokenizeFunction · 0.85
trimFunction · 0.85
findFunction · 0.85
NoneClass · 0.85
typeMethod · 0.80
CopyFromMethod · 0.80
insertMethod · 0.80
parseFunction · 0.70
addableFunction · 0.70
subtractFunction · 0.70
errorMethod · 0.65
ErrorFunction · 0.50

Tested by

no test coverage detected