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

Method handleInstanceEvent

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

Source from the content-addressed store, hash-verified

423}
424
425func (w *Worker) handleInstanceEvent(event common.ChangePayload) {
426 instance, ok := event.Payload.(params.Instance)
427 if !ok {
428 slog.DebugContext(w.ctx, "invalid payload type for instance event", "payload", event.Payload)
429 return
430 }
431 switch event.Operation {
432 case common.CreateOperation, common.UpdateOperation:
433 cache.SetInstanceCache(instance)
434 case common.DeleteOperation:
435 cache.DeleteInstanceCache(instance.Name)
436 }
437}
438
439func (w *Worker) handleTemplateEvent(event common.ChangePayload) {
440 template, ok := event.Payload.(params.Template)

Callers 1

handleEventMethod · 0.95

Calls 2

SetInstanceCacheFunction · 0.92
DeleteInstanceCacheFunction · 0.92

Tested by

no test coverage detected