Skip to content

Commit

Permalink
refactor: ptr.Equal
Browse files Browse the repository at this point in the history
  • Loading branch information
tenstad committed Feb 5, 2025
1 parent 2da22f9 commit 05ca2d3
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,9 @@ func toCloudianLimits(limits *v1alpha1.QualityOfServiceLimits) (cloudian.Quality
}

func limitsEqual(a cloudian.QualityOfServiceLimits, b cloudian.QualityOfServiceLimits) bool {
eq := func(a *int64, b *int64) bool {
return (a == b) || (a != nil && b != nil && *a == *b)
}

return eq(a.InboundKiBsPerMin, b.InboundKiBsPerMin) &&
eq(a.OutboundKiBsPerMin, b.OutboundKiBsPerMin) &&
eq(a.RequestsPerMin, b.RequestsPerMin) &&
eq(a.StorageQuotaCount, b.StorageQuotaCount) &&
eq(a.StorageQuotaKiBs, b.StorageQuotaKiBs)
return ptr.Equal(a.InboundKiBsPerMin, b.InboundKiBsPerMin) &&
ptr.Equal(a.OutboundKiBsPerMin, b.OutboundKiBsPerMin) &&
ptr.Equal(a.RequestsPerMin, b.RequestsPerMin) &&
ptr.Equal(a.StorageQuotaCount, b.StorageQuotaCount) &&
ptr.Equal(a.StorageQuotaKiBs, b.StorageQuotaKiBs)
}

0 comments on commit 05ca2d3

Please sign in to comment.