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

Method handlePoolEvent

workers/cache/cache.go:385–403  ·  view source on GitHub ↗
(event common.ChangePayload)

Source from the content-addressed store, hash-verified

383}
384
385func (w *Worker) handlePoolEvent(event common.ChangePayload) {
386 pool, ok := event.Payload.(params.Pool)
387 if !ok {
388 slog.DebugContext(w.ctx, "invalid payload type for pool event", "payload", event.Payload)
389 return
390 }
391 entity, err := pool.GetEntity()
392 if err != nil {
393 slog.DebugContext(w.ctx, "getting entity from pool", "error", err)
394 return
395 }
396
397 switch event.Operation {
398 case common.CreateOperation, common.UpdateOperation:
399 cache.SetEntityPool(entity.ID, pool)
400 case common.DeleteOperation:
401 cache.DeleteEntityPool(entity.ID, pool.ID)
402 }
403}
404
405func (w *Worker) handleScaleSetEvent(event common.ChangePayload) {
406 scaleSet, ok := event.Payload.(params.ScaleSet)

Callers 1

handleEventMethod · 0.95

Calls 3

SetEntityPoolFunction · 0.92
DeleteEntityPoolFunction · 0.92
GetEntityMethod · 0.65

Tested by

no test coverage detected