Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterHealthServer(s grpc.ServiceRegistrar, srv HealthServer)
- type HealthCheckRequest
- func (*HealthCheckRequest) Descriptor() ([]byte, []int)deprecated
- func (x *HealthCheckRequest) GetService() string
- func (*HealthCheckRequest) ProtoMessage()
- func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message
- func (x *HealthCheckRequest) Reset()
- func (x *HealthCheckRequest) String() string
- type HealthCheckResponse
- func (*HealthCheckResponse) Descriptor() ([]byte, []int)deprecated
- func (x *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus
- func (*HealthCheckResponse) ProtoMessage()
- func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message
- func (x *HealthCheckResponse) Reset()
- func (x *HealthCheckResponse) String() string
- type HealthCheckResponse_ServingStatus
- func (HealthCheckResponse_ServingStatus) Descriptor() protoreflect.EnumDescriptor
- func (x HealthCheckResponse_ServingStatus) Enum() *HealthCheckResponse_ServingStatus
- func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int)deprecated
- func (x HealthCheckResponse_ServingStatus) Number() protoreflect.EnumNumber
- func (x HealthCheckResponse_ServingStatus) String() string
- func (HealthCheckResponse_ServingStatus) Type() protoreflect.EnumType
- type HealthClient
- type HealthServer
- type Health_WatchClient
- type Health_WatchServer
- type ProbeServer
- func (h *ProbeServer) AddWatcher(id, service string) <-chan HealthCheckResponse_ServingStatus
- func (h *ProbeServer) Check(ctx context.Context, in *HealthCheckRequest) (out *HealthCheckResponse, err error)
- func (h *ProbeServer) DelWatcher(id string)
- func (h *ProbeServer) Healthy()
- func (h *ProbeServer) NotHealthy()
- func (h *ProbeServer) SetStatus(service string, status HealthCheckResponse_ServingStatus)
- func (h *ProbeServer) Status(service string, stream bool) (status HealthCheckResponse_ServingStatus)
- func (h *ProbeServer) Watch(in *HealthCheckRequest, stream Health_WatchServer) (err error)
- type UnimplementedHealthServer
- type UnsafeHealthServer
Constants ¶
const ( DefaultService = "default" CheckEndpoint = "/grpc.health.v1.Health/Check" WatchEndpoint = "/grpc.health.v1.Health/Watch" StatusServing = HealthCheckResponse_SERVING StatusNotServing = HealthCheckResponse_NOT_SERVING )
Variables ¶
var ( HealthCheckResponse_ServingStatus_name = map[int32]string{ 0: "UNKNOWN", 1: "SERVING", 2: "NOT_SERVING", 3: "SERVICE_UNKNOWN", } HealthCheckResponse_ServingStatus_value = map[string]int32{ "UNKNOWN": 0, "SERVING": 1, "NOT_SERVING": 2, "SERVICE_UNKNOWN": 3, } )
Enum value maps for HealthCheckResponse_ServingStatus.
var File_grpc_health_v1_health_proto protoreflect.FileDescriptor
var Health_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grpc.health.v1.Health", HandlerType: (*HealthServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Check", Handler: _Health_Check_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Watch", Handler: _Health_Watch_Handler, ServerStreams: true, }, }, Metadata: "grpc/health/v1/health.proto", }
Health_ServiceDesc is the grpc.ServiceDesc for Health service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterHealthServer ¶
func RegisterHealthServer(s grpc.ServiceRegistrar, srv HealthServer)
Types ¶
type HealthCheckRequest ¶
type HealthCheckRequest struct { Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` // contains filtered or unexported fields }
func (*HealthCheckRequest) Descriptor
deprecated
func (*HealthCheckRequest) Descriptor() ([]byte, []int)
Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead.
func (*HealthCheckRequest) GetService ¶
func (x *HealthCheckRequest) GetService() string
func (*HealthCheckRequest) ProtoMessage ¶
func (*HealthCheckRequest) ProtoMessage()
func (*HealthCheckRequest) ProtoReflect ¶
func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message
func (*HealthCheckRequest) Reset ¶
func (x *HealthCheckRequest) Reset()
func (*HealthCheckRequest) String ¶
func (x *HealthCheckRequest) String() string
type HealthCheckResponse ¶
type HealthCheckResponse struct { Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,proto3,enum=grpc.health.v1.HealthCheckResponse_ServingStatus" json:"status,omitempty"` // contains filtered or unexported fields }
func (*HealthCheckResponse) Descriptor
deprecated
func (*HealthCheckResponse) Descriptor() ([]byte, []int)
Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead.
func (*HealthCheckResponse) GetStatus ¶
func (x *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus
func (*HealthCheckResponse) ProtoMessage ¶
func (*HealthCheckResponse) ProtoMessage()
func (*HealthCheckResponse) ProtoReflect ¶
func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message
func (*HealthCheckResponse) Reset ¶
func (x *HealthCheckResponse) Reset()
func (*HealthCheckResponse) String ¶
func (x *HealthCheckResponse) String() string
type HealthCheckResponse_ServingStatus ¶
type HealthCheckResponse_ServingStatus int32
const ( HealthCheckResponse_UNKNOWN HealthCheckResponse_ServingStatus = 0 HealthCheckResponse_SERVING HealthCheckResponse_ServingStatus = 1 HealthCheckResponse_NOT_SERVING HealthCheckResponse_ServingStatus = 2 HealthCheckResponse_SERVICE_UNKNOWN HealthCheckResponse_ServingStatus = 3 // Used only by the Watch method. )
func (HealthCheckResponse_ServingStatus) Descriptor ¶
func (HealthCheckResponse_ServingStatus) Descriptor() protoreflect.EnumDescriptor
func (HealthCheckResponse_ServingStatus) Enum ¶
func (x HealthCheckResponse_ServingStatus) Enum() *HealthCheckResponse_ServingStatus
func (HealthCheckResponse_ServingStatus) EnumDescriptor
deprecated
func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int)
Deprecated: Use HealthCheckResponse_ServingStatus.Descriptor instead.
func (HealthCheckResponse_ServingStatus) Number ¶
func (x HealthCheckResponse_ServingStatus) Number() protoreflect.EnumNumber
func (HealthCheckResponse_ServingStatus) String ¶
func (x HealthCheckResponse_ServingStatus) String() string
func (HealthCheckResponse_ServingStatus) Type ¶
func (HealthCheckResponse_ServingStatus) Type() protoreflect.EnumType
type HealthClient ¶
type HealthClient interface { Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (Health_WatchClient, error) }
HealthClient is the client API for Health service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewHealthClient ¶
func NewHealthClient(cc grpc.ClientConnInterface) HealthClient
type HealthServer ¶
type HealthServer interface { Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) Watch(*HealthCheckRequest, Health_WatchServer) error // contains filtered or unexported methods }
HealthServer is the server API for Health service. All implementations must embed UnimplementedHealthServer for forward compatibility
type Health_WatchClient ¶
type Health_WatchClient interface { Recv() (*HealthCheckResponse, error) grpc.ClientStream }
type Health_WatchServer ¶
type Health_WatchServer interface { Send(*HealthCheckResponse) error grpc.ServerStream }
type ProbeServer ¶
type ProbeServer struct { sync.RWMutex UnimplementedHealthServer // contains filtered or unexported fields }
ProbeServer implements the grpc.health.v1.Health service to provide status information on different services that the gRPC server may be running. The intended use case is to embed the ProbeServer into a gRPC server implementation and to set the status of the probes services using the state method.
func (*ProbeServer) AddWatcher ¶
func (h *ProbeServer) AddWatcher(id, service string) <-chan HealthCheckResponse_ServingStatus
Add a watcher with a unique ID to listen for status changes for the specified service. A channel is returned that will broadcast status changes for that service.
func (*ProbeServer) Check ¶
func (h *ProbeServer) Check(ctx context.Context, in *HealthCheckRequest) (out *HealthCheckResponse, err error)
Check implements the Health service interface and is a Unary response to a health check request for the specified service. If the specified service is empty the status of the default service is returned.
func (*ProbeServer) DelWatcher ¶
func (h *ProbeServer) DelWatcher(id string)
Remove a watcher with the specified unique id and stop listening for status changes.
func (*ProbeServer) Healthy ¶
func (h *ProbeServer) Healthy()
Healthy sets the probe server default service as serving.
func (*ProbeServer) NotHealthy ¶
func (h *ProbeServer) NotHealthy()
NotHealthy sets the probe server default service to not serving.
func (*ProbeServer) SetStatus ¶
func (h *ProbeServer) SetStatus(service string, status HealthCheckResponse_ServingStatus)
Sets the status of the specified service, notifying all watchers about the change in status. Callers should not set the status to Unknown or Service Unknown. If an empty string is sepcified as the service, the default service is used instead.
func (*ProbeServer) Status ¶
func (h *ProbeServer) Status(service string, stream bool) (status HealthCheckResponse_ServingStatus)
Status returns the status of the specified service. If empty string is provided then the "default service" is used to lookup the status.
func (*ProbeServer) Watch ¶
func (h *ProbeServer) Watch(in *HealthCheckRequest, stream Health_WatchServer) (err error)
Watch implements the Health service interface and provides server-side streaming updates of when the status of a specific service changes. If the specified service is empty then the status of the default service is returned.
type UnimplementedHealthServer ¶
type UnimplementedHealthServer struct { }
UnimplementedHealthServer must be embedded to have forward compatible implementations.
func (UnimplementedHealthServer) Check ¶
func (UnimplementedHealthServer) Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
func (UnimplementedHealthServer) Watch ¶
func (UnimplementedHealthServer) Watch(*HealthCheckRequest, Health_WatchServer) error
type UnsafeHealthServer ¶
type UnsafeHealthServer interface {
// contains filtered or unexported methods
}
UnsafeHealthServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HealthServer will result in compilation errors.