MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / UpdateMonitor

Method UpdateMonitor

balance.go:438–452  ·  view source on GitHub ↗

UpdateMonitor updates an existing balance monitor. It starts a tracing span, updates the monitor, and records relevant events and errors. Parameters: - ctx context.Context: The context for the operation. - monitor *model.BalanceMonitor: A pointer to the BalanceMonitor model to be updated. Returns:

(ctx context.Context, monitor *model.BalanceMonitor)

Source from the content-addressed store, hash-verified

436// Returns:
437// - error: An error if the monitor could not be updated.
438func (l *LedgerForge) UpdateMonitor(ctx context.Context, monitor *model.BalanceMonitor) error {
439 _, span := balanceTracer.Start(ctx, "UpdateMonitor")
440 defer span.End()
441
442 err := l.datasource.UpdateMonitor(monitor)
443 if err != nil {
444 span.RecordError(err)
445 return err
446 }
447
448 _ = l.cache.Delete(ctx, "monitors:"+monitor.BalanceID)
449
450 span.AddEvent("Monitor updated", trace.WithAttributes(attribute.String("monitor.id", monitor.MonitorID)))
451 return nil
452}
453
454// DeleteMonitor deletes a balance monitor by its ID.
455// It starts a tracing span, deletes the monitor, and records relevant events and errors.

Callers 1

TestUpdateMonitorFunction · 0.95

Calls 3

UpdateMonitorMethod · 0.65
DeleteMethod · 0.65
StartMethod · 0.45

Tested by 1

TestUpdateMonitorFunction · 0.76