github.com/MetalBlockchain/metalgo@v1.11.9/api/health/checker.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package health 5 6 import "context" 7 8 var _ Checker = CheckerFunc(nil) 9 10 // Checker can have its health checked 11 type Checker interface { 12 // HealthCheck returns health check results and, if not healthy, a non-nil 13 // error 14 // 15 // It is expected that the results are json marshallable. 16 HealthCheck(context.Context) (interface{}, error) 17 } 18 19 type CheckerFunc func(context.Context) (interface{}, error) 20 21 func (f CheckerFunc) HealthCheck(ctx context.Context) (interface{}, error) { 22 return f(ctx) 23 }