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

Method ListBenchmarks

server/handlers/eval.go:450–478  ·  view source on GitHub ↗

ListBenchmarks lists all benchmarks

(c *gin.Context)

Source from the content-addressed store, hash-verified

448
449// ListBenchmarks lists all benchmarks
450func (h *EvalHandler) ListBenchmarks(c *gin.Context) {
451 ctx := c.Request.Context()
452
453 records, err := (*h.store).List(ctx, "benchmarks")
454 if err != nil {
455 c.JSON(http.StatusInternalServerError, gin.H{
456 "success": false,
457 "error": gin.H{
458 "code": "internal_error",
459 "message": err.Error(),
460 },
461 })
462 return
463 }
464
465 benchmarks := make([]*BenchmarkRecord, 0)
466 for _, record := range records {
467 var benchmark BenchmarkRecord
468 if err := store.DecodeValue(record, &benchmark); err != nil {
469 continue
470 }
471 benchmarks = append(benchmarks, &benchmark)
472 }
473
474 c.JSON(http.StatusOK, gin.H{
475 "success": true,
476 "data": benchmarks,
477 })
478}
479
480// GetBenchmark retrieves a single benchmark
481func (h *EvalHandler) GetBenchmark(c *gin.Context) {

Callers

nothing calls this directly

Calls 5

DecodeValueFunction · 0.92
JSONMethod · 0.80
ContextMethod · 0.65
ListMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected