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

Method add

src/common/resources.cpp:2236–2263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2234
2235
2236void Resources::add(const Resource_& that)
2237{
2238 if (that.isEmpty()) {
2239 return;
2240 }
2241
2242 bool found = false;
2243 foreach (
2244 Resource_Unsafe& resource_,
2245 resourcesNoMutationWithoutExclusiveOwnership) {
2246 if (internal::addable(resource_->resource, that.resource)) {
2247 // Copy-on-write (if more than 1 reference).
2248 if (resource_.use_count() > 1) {
2249 resource_ = make_shared<Resource_>(*resource_);
2250 }
2251
2252 *resource_ += that;
2253 found = true;
2254 break;
2255 }
2256 }
2257
2258 // Cannot be combined with any existing Resource object.
2259 if (!found) {
2260 resourcesNoMutationWithoutExclusiveOwnership.push_back(
2261 make_shared<Resource_>(that));
2262 }
2263}
2264
2265
2266void Resources::add(Resource_&& that)

Callers 12

foreachFunction · 0.45
parseMethod · 0.45
deleteVolumeMethod · 0.45
attachVolumeMethod · 0.45
detachVolumeMethod · 0.45
publishVolumeMethod · 0.45
unpublishVolumeMethod · 0.45
deleteVolumeMethod · 0.45
attachVolumeMethod · 0.45
detachVolumeMethod · 0.45
publishVolumeMethod · 0.45
unpublishVolumeMethod · 0.45

Calls 1

isEmptyMethod · 0.45

Tested by

no test coverage detected