health

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2024 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Status_name = map[int32]string{
		0: "UNKNOWN",
		1: "UP",
		2: "DOWN",
	}
	Status_value = map[string]int32{
		"UNKNOWN": 0,
		"UP":      1,
		"DOWN":    2,
	}
)

Enum value maps for Status.

View Source
var File_health_proto protoreflect.FileDescriptor

Functions

func AsChecker

func AsChecker[T Checker]() interface{}

AsChecker is a health-checker transformer.

func AsHealth

func AsHealth(f any) any

AsHealth is a health-server transformer.

Types

type Checker

type Checker interface {
	Check(ctx context.Context) error
}

type CheckerFunc

type CheckerFunc func() error

func (CheckerFunc) Check

func (f CheckerFunc) Check(ctx context.Context) error

type HealthReply

type HealthReply struct {
	Status     Status            `protobuf:"varint,1,opt,name=status,proto3,enum=api.health.Status" json:"status,omitempty"`
	Components map[string]Status `` /* 185-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*HealthReply) Descriptor deprecated

func (*HealthReply) Descriptor() ([]byte, []int)

Deprecated: Use HealthReply.ProtoReflect.Descriptor instead.

func (*HealthReply) GetComponents

func (x *HealthReply) GetComponents() map[string]Status

func (*HealthReply) GetStatus

func (x *HealthReply) GetStatus() Status

func (*HealthReply) ProtoMessage

func (*HealthReply) ProtoMessage()

func (*HealthReply) ProtoReflect

func (x *HealthReply) ProtoReflect() protoreflect.Message

func (*HealthReply) Reset

func (x *HealthReply) Reset()

func (*HealthReply) String

func (x *HealthReply) String() string

type HealthRequest

type HealthRequest struct {
	// contains filtered or unexported fields
}

func (*HealthRequest) Descriptor deprecated

func (*HealthRequest) Descriptor() ([]byte, []int)

Deprecated: Use HealthRequest.ProtoReflect.Descriptor instead.

func (*HealthRequest) ProtoMessage

func (*HealthRequest) ProtoMessage()

func (*HealthRequest) ProtoReflect

func (x *HealthRequest) ProtoReflect() protoreflect.Message

func (*HealthRequest) Reset

func (x *HealthRequest) Reset()

func (*HealthRequest) String

func (x *HealthRequest) String() string

type HealthService

type HealthService struct {
	// contains filtered or unexported fields
}

HealthService is a health service.

func NewHealthService

func NewHealthService(logger log.Logger, checkers []Checker) *HealthService

func (*HealthService) Health

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(health []Checker, logger log.Logger, s *http.Server) *Server

func (*Server) Start

func (h *Server) Start(ctx context.Context) error

func (*Server) Stop

func (h *Server) Stop(ctx context.Context) error

type Status

type Status int32
const (
	Status_UNKNOWN Status = 0
	Status_UP      Status = 1
	Status_DOWN    Status = 2
)

func (Status) Descriptor

func (Status) Descriptor() protoreflect.EnumDescriptor

func (Status) Enum

func (x Status) Enum() *Status

func (Status) EnumDescriptor deprecated

func (Status) EnumDescriptor() ([]byte, []int)

Deprecated: Use Status.Descriptor instead.

func (Status) Number

func (x Status) Number() protoreflect.EnumNumber

func (Status) String

func (x Status) String() string

func (Status) Type

func (Status) Type() protoreflect.EnumType

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL