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

Method filter

src/v1/resources.cpp:1615–1632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1613
1614
1615Resources Resources::filter(
1616 const lambda::function<bool(const Resource&)>& predicate) const
1617{
1618 Resources result;
1619 result.resourcesNoMutationWithoutExclusiveOwnership.reserve(this->size());
1620 foreach (
1621 const Resource_Unsafe& resource_,
1622 resourcesNoMutationWithoutExclusiveOwnership) {
1623 if (predicate(resource_->resource)) {
1624 // We `push_back()` here instead of `add()` (which is O(n)). `add()` is
1625 // not necessary because we assume all Resource objects are already
1626 // combined in `Resources` and `filter()` should only take away
1627 // resource objects.
1628 result.resourcesNoMutationWithoutExclusiveOwnership.push_back(resource_);
1629 }
1630 }
1631 return result;
1632}
1633
1634
1635hashmap<string, Resources> Resources::reservations() const

Callers 15

allowsReconciliationMethod · 0.45
getExistingVolumesMethod · 0.45
getStoragePoolsMethod · 0.45
TEST_FFunction · 0.45
TEST_PFunction · 0.45
TEST_PFunction · 0.45
createAgentResourcesMethod · 0.45
TEST_PFunction · 0.45
TEST_PFunction · 0.45
TEST_FFunction · 0.45

Calls 2

sizeMethod · 0.95
reserveMethod · 0.45

Tested by 13

TEST_FFunction · 0.36
TEST_PFunction · 0.36
TEST_PFunction · 0.36
createAgentResourcesMethod · 0.36
TEST_PFunction · 0.36
TEST_PFunction · 0.36
TEST_FFunction · 0.36
TEST_PFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36