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

Method filter

src/common/resources.cpp:1631–1648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1629
1630
1631Resources Resources::filter(
1632 const lambda::function<bool(const Resource&)>& predicate) const
1633{
1634 Resources result;
1635 result.resourcesNoMutationWithoutExclusiveOwnership.reserve(this->size());
1636 foreach (
1637 const Resource_Unsafe& resource_,
1638 resourcesNoMutationWithoutExclusiveOwnership) {
1639 if (predicate(resource_->resource)) {
1640 // We `push_back()` here instead of `add()` (which is O(n)). `add()` is
1641 // not necessary because we assume all Resource objects are already
1642 // combined in `Resources` and `filter()` should only take away
1643 // resource objects.
1644 result.resourcesNoMutationWithoutExclusiveOwnership.push_back(resource_);
1645 }
1646 }
1647 return result;
1648}
1649
1650
1651hashmap<string, Resources> Resources::reservations() const

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.95
reserveMethod · 0.45

Tested by

no test coverage detected