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

Function compareResourceMetadata

src/common/resources.cpp:275–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273
274
275static bool compareResourceMetadata(const Resource& left, const Resource& right)
276{
277 if (left.name() != right.name() || left.type() != right.type()) {
278 return false;
279 }
280
281 // Check AllocationInfo.
282 if (left.has_allocation_info() != right.has_allocation_info()) {
283 return false;
284 }
285
286 if (left.has_allocation_info() &&
287 left.allocation_info() != right.allocation_info()) {
288 return false;
289 }
290
291 // Check the stack of ReservationInfo.
292 if (left.reservations_size() != right.reservations_size()) {
293 return false;
294 }
295
296 for (int i = 0; i < left.reservations_size(); ++i) {
297 if (left.reservations(i) != right.reservations(i)) {
298 return false;
299 }
300 }
301
302 // Check DiskInfo.
303 if (left.has_disk() != right.has_disk()) {
304 return false;
305 }
306
307 if (left.has_disk() && left.disk() != right.disk()) {
308 return false;
309 }
310
311 // Check RevocableInfo.
312 if (left.has_revocable() != right.has_revocable()) {
313 return false;
314 }
315
316 // Check ResourceProviderID.
317 if (left.has_provider_id() != right.has_provider_id()) {
318 return false;
319 }
320
321 if (left.has_provider_id() && left.provider_id() != right.provider_id()) {
322 return false;
323 }
324
325 // Check SharedInfo.
326 if (left.has_shared() != right.has_shared()) {
327 return false;
328 }
329
330 return true;
331}
332

Callers 2

operator==Function · 0.85
foreachFunction · 0.85

Calls 4

typeMethod · 0.80
nameMethod · 0.45
reservationsMethod · 0.45
diskMethod · 0.45

Tested by

no test coverage detected