Skip to content

Commit 13d77f8

Browse files
atantawiopenshift-merge-robot
authored andcommitted
added getters for QuotaTree and TreeController
1 parent 3748e45 commit 13d77f8

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

pkg/quotaplugins/quota-forest/quota-manager/quota/core/quotatree.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,15 @@ func (qt *QuotaTree) GetQuotaSize() int {
209209
return len(qt.resourceNames)
210210
}
211211

212+
// GetNodes : get a map of all quota nodes in the tree
213+
func (qt *QuotaTree) GetNodes() map[string]*QuotaNode {
214+
nodeMap := make(map[string]*QuotaNode)
215+
for _, n := range qt.Tree.GetNodeListBFS() {
216+
nodeMap[n.GetID()] = (*QuotaNode)(unsafe.Pointer(n))
217+
}
218+
return nodeMap
219+
}
220+
212221
// StringSimply :
213222
func (qt *QuotaTree) StringSimply() string {
214223
var b bytes.Buffer

pkg/quotaplugins/quota-forest/quota-manager/quota/core/treecontroller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ func (controller *Controller) DeAllocate(consumerID string) bool {
138138
return false
139139
}
140140

141+
// GetConsumers : get a map of consumers in controller
142+
func (controller *Controller) GetConsumers() map[string]*Consumer {
143+
return controller.consumers
144+
}
145+
141146
// GetPreemptedConsumers : get a list of the preempted consumer IDs
142147
func (controller *Controller) GetPreemptedConsumers() []string {
143148
return controller.preemptedConsumers

0 commit comments

Comments
 (0)