MCPcopy Create free account
hub / github.com/cloudbase/garm / GetEntityInstances

Method GetEntityInstances

cache/instance_cache.go:138–152  ·  view source on GitHub ↗
(entityID string)

Source from the content-addressed store, hash-verified

136}
137
138func (i *InstanceCache) GetEntityInstances(entityID string) []params.Instance {
139 pools := GetEntityPools(entityID)
140 poolsAsMap := map[string]bool{}
141 for _, pool := range pools {
142 poolsAsMap[pool.ID] = true
143 }
144
145 ret := []params.Instance{}
146 for _, val := range i.GetAllInstances() {
147 if _, ok := poolsAsMap[val.PoolID]; ok {
148 ret = append(ret, val)
149 }
150 }
151 return ret
152}
153
154func SetInstanceCache(instance params.Instance) {
155 instanceCache.SetInstance(instance)

Callers 1

GetEntityInstancesFunction · 0.80

Calls 2

GetAllInstancesMethod · 0.95
GetEntityPoolsFunction · 0.85

Tested by

no test coverage detected