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

Function value

src/common/http.cpp:433–450  ·  view source on GitHub ↗

Helper function that returns the JSON::value of a given resource (identified by 'name' and 'type') inside the resources.

Source from the content-addressed store, hash-verified

431// Helper function that returns the JSON::value of a given resource (identified
432// by 'name' and 'type') inside the resources.
433static JSON::Value value(
434 const string& name,
435 const Value::Type& type,
436 const Resources& resources)
437{
438 switch (type) {
439 case Value::SCALAR:
440 return resources.get<Value::Scalar>(name)->value();
441 case Value::RANGES:
442 return stringify(resources.get<Value::Ranges>(name).get());
443 case Value::SET:
444 return stringify(resources.get<Value::Set>(name).get());
445 default:
446 LOG(FATAL) << "Unexpected Value type: " << type;
447 }
448
449 UNREACHABLE();
450}
451
452
453JSON::Object model(const Resources& resources)

Callers 1

foreachpairFunction · 0.85

Calls 3

stringifyFunction · 0.50
valueMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected