richscott commented on code in PR #897:
URL: https://github.com/apache/yunikorn-core/pull/897#discussion_r1697411892


##########
pkg/common/resources/tracked_resources.go:
##########
@@ -103,3 +103,46 @@ func (tr *TrackedResource) 
AggregateTrackedResource(instType string,
        }
        tr.TrackedResourceMap[instType] = aggregatedResourceTime
 }
+
+func EqualsTracked(left, right *TrackedResource) bool {
+       if left == right {
+               return true
+       }
+
+       if left == nil || right == nil {
+               return false
+       }
+
+       equals := true
+       for k, v := range left.TrackedResourceMap {
+               inner, ok := right.TrackedResourceMap[k]
+               if !ok {
+                       return false
+               }
+
+               equals = equals && equalsMapContents(v, inner)
+       }
+
+       return equals
+}
+
+// basically the same as Equals()
+func equalsMapContents(left, right map[string]int64) bool {
+       if left == nil || right == nil { // probably this is not needed
+               return false
+       }

Review Comment:
   Fixed in commit 9b3c237



##########
pkg/common/resources/tracked_resources.go:
##########
@@ -103,3 +103,46 @@ func (tr *TrackedResource) 
AggregateTrackedResource(instType string,
        }
        tr.TrackedResourceMap[instType] = aggregatedResourceTime
 }
+
+func EqualsTracked(left, right *TrackedResource) bool {
+       if left == right {
+               return true
+       }
+
+       if left == nil || right == nil {
+               return false
+       }
+
+       equals := true
+       for k, v := range left.TrackedResourceMap {
+               inner, ok := right.TrackedResourceMap[k]
+               if !ok {
+                       return false
+               }
+
+               equals = equals && equalsMapContents(v, inner)
+       }
+
+       return equals
+}
+
+// basically the same as Equals()

Review Comment:
   Fixed in commit 9b3c237



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to