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

Method GetEntityForPool

cache/entity_cache.go:73–90  ·  view source on GitHub ↗
(poolID string)

Source from the content-addressed store, hash-verified

71}
72
73func (e *EntityCache) GetEntityForPool(poolID string) (params.ForgeEntity, bool) {
74 e.mux.Lock()
75 defer e.mux.Unlock()
76
77 pool, ok := e.pools[poolID]
78 if !ok {
79 return params.ForgeEntity{}, false
80 }
81
82 entity, err := pool.GetEntity()
83 if err != nil {
84 return params.ForgeEntity{}, false
85 }
86 if cacheEntity, ok := e.entities[entity.ID]; ok {
87 return cacheEntity.Entity, true
88 }
89 return params.ForgeEntity{}, false
90}
91
92func (e *EntityCache) GetPoolByID(poolID string) (params.Pool, bool) {
93 e.mux.Lock()

Callers 1

GetEntityForPoolFunction · 0.80

Calls 3

LockMethod · 0.65
UnlockMethod · 0.65
GetEntityMethod · 0.65

Tested by

no test coverage detected