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

Method handleEndpointEvent

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

Source from the content-addressed store, hash-verified

485}
486
487func (w *Worker) handleEndpointEvent(event common.ChangePayload) {
488 endpoint, ok := event.Payload.(params.ForgeEndpoint)
489 if !ok {
490 slog.DebugContext(w.ctx, "invalid payload type for endpoint event", "payload", event.Payload)
491 return
492 }
493 switch event.Operation {
494 case common.UpdateOperation, common.CreateOperation:
495 cache.SetEndpoint(endpoint)
496 entities := cache.GetEntitiesUsingEndpoint(endpoint)
497 for _, entity := range entities {
498 worker, ok := w.toolsWorkes[entity.ID]
499 if ok {
500 worker.Reset()
501 }
502 }
503 case common.DeleteOperation:
504 cache.RemoveEndpoint(endpoint.Name)
505 }
506}
507
508func (w *Worker) handleControllerInfoEvent(event common.ChangePayload) {
509 ctrlInfo, ok := event.Payload.(params.ControllerInfo)

Callers 1

handleEventMethod · 0.95

Calls 4

SetEndpointFunction · 0.92
GetEntitiesUsingEndpointFunction · 0.92
RemoveEndpointFunction · 0.92
ResetMethod · 0.65

Tested by

no test coverage detected