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

Method GetEntityForScaleSet

cache/entity_cache.go:54–71  ·  view source on GitHub ↗
(scaleSetID uint)

Source from the content-addressed store, hash-verified

52}
53
54func (e *EntityCache) GetEntityForScaleSet(scaleSetID uint) (params.ForgeEntity, bool) {
55 e.mux.Lock()
56 defer e.mux.Unlock()
57
58 scaleSet, ok := e.scalesets[scaleSetID]
59 if !ok {
60 return params.ForgeEntity{}, false
61 }
62
63 entity, err := scaleSet.GetEntity()
64 if err != nil {
65 return params.ForgeEntity{}, false
66 }
67 if cacheEntity, ok := e.entities[entity.ID]; ok {
68 return cacheEntity.Entity, true
69 }
70 return params.ForgeEntity{}, false
71}
72
73func (e *EntityCache) GetEntityForPool(poolID string) (params.ForgeEntity, bool) {
74 e.mux.Lock()

Callers 1

GetEntityForScaleSetFunction · 0.80

Calls 3

LockMethod · 0.65
UnlockMethod · 0.65
GetEntityMethod · 0.65

Tested by

no test coverage detected