MCPcopy Create free account
hub / github.com/astercloud/aster / DeleteBenchmark

Method DeleteBenchmark

server/handlers/eval.go:514–544  ·  view source on GitHub ↗

DeleteBenchmark deletes a benchmark

(c *gin.Context)

Source from the content-addressed store, hash-verified

512
513// DeleteBenchmark deletes a benchmark
514func (h *EvalHandler) DeleteBenchmark(c *gin.Context) {
515 ctx := c.Request.Context()
516 id := c.Param("id")
517
518 if err := (*h.store).Delete(ctx, "benchmarks", id); err != nil {
519 if errors.Is(err, store.ErrNotFound) {
520 c.JSON(http.StatusNotFound, gin.H{
521 "success": false,
522 "error": gin.H{
523 "code": "not_found",
524 "message": "Benchmark not found",
525 },
526 })
527 return
528 }
529 c.JSON(http.StatusInternalServerError, gin.H{
530 "success": false,
531 "error": gin.H{
532 "code": "internal_error",
533 "message": err.Error(),
534 },
535 })
536 return
537 }
538
539 logging.Info(ctx, "benchmark.deleted", map[string]any{
540 "id": id,
541 })
542
543 c.Status(http.StatusNoContent)
544}
545
546// RunBenchmark runs a benchmark
547func (h *EvalHandler) RunBenchmark(c *gin.Context) {

Callers

nothing calls this directly

Calls 6

InfoFunction · 0.92
JSONMethod · 0.80
ContextMethod · 0.65
DeleteMethod · 0.65
ErrorMethod · 0.65
StatusMethod · 0.45

Tested by

no test coverage detected