wilfred-s commented on a change in pull request #108: [YUNIKORN-47] Support 
node update action
URL: 
https://github.com/apache/incubator-yunikorn-core/pull/108#discussion_r397807292
 
 

 ##########
 File path: pkg/cache/node_info.go
 ##########
 @@ -109,6 +112,40 @@ func (ni *NodeInfo) GetCapacity() *resources.Resource {
        return ni.totalResource.Clone()
 }
 
+func (ni *NodeInfo) SetCapacity(newCapacity *resources.Resource) {
+       ni.lock.Lock()
+       defer ni.lock.Unlock()
+       if resources.Equals(ni.totalResource, newCapacity) {
+               log.Logger().Info("skip updating capacity, not changed")
+               return
+       }
+
+       ni.totalResource = newCapacity
+       ni.availableResource = ni.totalResource.Clone()
+       ni.availableResource.SubFrom(ni.allocatedResource)
+       ni.availableResource.SubFrom(ni.occupiedResource)
+}
+
+func (ni *NodeInfo) GetOccupiedResource() *resources.Resource {
+       ni.lock.RLock()
+       defer ni.lock.RUnlock()
+       return ni.occupiedResource.Clone()
+}
+
+func (ni *NodeInfo) SetOccupiedResource(occupiedResource *resources.Resource) {
 
 Review comment:
   Should not be exported

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@yunikorn.apache.org
For additional commands, e-mail: dev-h...@yunikorn.apache.org

Reply via email to