health

package
v0.0.0-...-6367170 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package health is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_health_proto protoreflect.FileDescriptor
View Source
var HeartbeatAPI_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "phogolabs.plex.health.HeartbeatAPI",
	HandlerType: (*HeartbeatAPIServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CheckLive",
			Handler:    _HeartbeatAPI_CheckLive_Handler,
		},
		{
			MethodName: "CheckReady",
			Handler:    _HeartbeatAPI_CheckReady_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "health.proto",
}

HeartbeatAPI_ServiceDesc is the grpc.ServiceDesc for HeartbeatAPI service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterHeartbeatAPIHandler

func RegisterHeartbeatAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterHeartbeatAPIHandler registers the http handlers for service HeartbeatAPI to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterHeartbeatAPIHandlerClient

func RegisterHeartbeatAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HeartbeatAPIClient) error

RegisterHeartbeatAPIHandlerClient registers the http handlers for service HeartbeatAPI to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "HeartbeatAPIClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "HeartbeatAPIClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "HeartbeatAPIClient" to call the correct interceptors.

func RegisterHeartbeatAPIHandlerFromEndpoint

func RegisterHeartbeatAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterHeartbeatAPIHandlerFromEndpoint is same as RegisterHeartbeatAPIHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterHeartbeatAPIHandlerServer

func RegisterHeartbeatAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HeartbeatAPIServer) error

RegisterHeartbeatAPIHandlerServer registers the http handlers for service HeartbeatAPI to "mux". UnaryRPC :call HeartbeatAPIServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterHeartbeatAPIHandlerFromEndpoint instead.

func RegisterHeartbeatAPIServer

func RegisterHeartbeatAPIServer(s grpc.ServiceRegistrar, srv HeartbeatAPIServer)

Types

type CheckLiveRequest

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

CheckLiveRequest is the payload sent to check the live state

func (*CheckLiveRequest) Descriptor deprecated

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

Deprecated: Use CheckLiveRequest.ProtoReflect.Descriptor instead.

func (*CheckLiveRequest) ProtoMessage

func (*CheckLiveRequest) ProtoMessage()

func (*CheckLiveRequest) ProtoReflect

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

func (*CheckLiveRequest) Reset

func (x *CheckLiveRequest) Reset()

func (*CheckLiveRequest) String

func (x *CheckLiveRequest) String() string

type CheckLiveResponse

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

CheckLiveResponse is the live state payload returned to the client

func (*CheckLiveResponse) Descriptor deprecated

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

Deprecated: Use CheckLiveResponse.ProtoReflect.Descriptor instead.

func (*CheckLiveResponse) ProtoMessage

func (*CheckLiveResponse) ProtoMessage()

func (*CheckLiveResponse) ProtoReflect

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

func (*CheckLiveResponse) Reset

func (x *CheckLiveResponse) Reset()

func (*CheckLiveResponse) String

func (x *CheckLiveResponse) String() string

type CheckReadyRequest

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

CheckReadyRequest is the payload sent to check the ready state

func (*CheckReadyRequest) Descriptor deprecated

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

Deprecated: Use CheckReadyRequest.ProtoReflect.Descriptor instead.

func (*CheckReadyRequest) ProtoMessage

func (*CheckReadyRequest) ProtoMessage()

func (*CheckReadyRequest) ProtoReflect

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

func (*CheckReadyRequest) Reset

func (x *CheckReadyRequest) Reset()

func (*CheckReadyRequest) String

func (x *CheckReadyRequest) String() string

type CheckReadyResponse

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

CheckReadyResponse is the ready state payload returned to the client

func (*CheckReadyResponse) Descriptor deprecated

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

Deprecated: Use CheckReadyResponse.ProtoReflect.Descriptor instead.

func (*CheckReadyResponse) ProtoMessage

func (*CheckReadyResponse) ProtoMessage()

func (*CheckReadyResponse) ProtoReflect

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

func (*CheckReadyResponse) Reset

func (x *CheckReadyResponse) Reset()

func (*CheckReadyResponse) String

func (x *CheckReadyResponse) String() string

type Checker

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

Checker checks the health

type CheckerFunc

type CheckerFunc func(context.Context) error

CheckerFunc represents a cheker function

func (CheckerFunc) Check

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

Check checks the resource

func (CheckerFunc) Name

func (fn CheckerFunc) Name() string

Name returns the name of the cheker

type HeartbeatAPI

type HeartbeatAPI struct {
	LiveCheckers  []Checker
	ReadyCheckers []Checker
}

HeartbeatAPI is the server API for HeartbeatAPI service.

func New

func New() *HeartbeatAPI

New creates a new HeartbeatAPI

func (*HeartbeatAPI) CheckLive

CheckLive checks the live state

func (*HeartbeatAPI) CheckReady

CheckReady checks the ready state

func (*HeartbeatAPI) LogLevel

func (h *HeartbeatAPI) LogLevel() log.Level

LogLevel returns the desired log level

func (*HeartbeatAPI) Mount

func (h *HeartbeatAPI) Mount(server *plex.Server)

Mount mounts the handler

func (*HeartbeatAPI) UseLiveCheck

func (h *HeartbeatAPI) UseLiveCheck(checker Checker)

UseLiveCheck appends a live check

func (*HeartbeatAPI) UseReadyCheck

func (h *HeartbeatAPI) UseReadyCheck(checker Checker)

UseReadyCheck appends a ready check

type HeartbeatAPIClient

type HeartbeatAPIClient interface {
	// CheckLive checks the live state
	CheckLive(ctx context.Context, in *CheckLiveRequest, opts ...grpc.CallOption) (*CheckLiveResponse, error)
	// CheckReady checks the ready state
	CheckReady(ctx context.Context, in *CheckReadyRequest, opts ...grpc.CallOption) (*CheckReadyResponse, error)
}

HeartbeatAPIClient is the client API for HeartbeatAPI 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.

type HeartbeatAPIServer

type HeartbeatAPIServer interface {
	// CheckLive checks the live state
	CheckLive(context.Context, *CheckLiveRequest) (*CheckLiveResponse, error)
	// CheckReady checks the ready state
	CheckReady(context.Context, *CheckReadyRequest) (*CheckReadyResponse, error)
}

HeartbeatAPIServer is the server API for HeartbeatAPI service. All implementations should embed UnimplementedHeartbeatAPIServer for forward compatibility

type UnimplementedHeartbeatAPIServer

type UnimplementedHeartbeatAPIServer struct {
}

UnimplementedHeartbeatAPIServer should be embedded to have forward compatible implementations.

func (UnimplementedHeartbeatAPIServer) CheckLive

func (UnimplementedHeartbeatAPIServer) CheckReady

type UnsafeHeartbeatAPIServer

type UnsafeHeartbeatAPIServer interface {
	// contains filtered or unexported methods
}

UnsafeHeartbeatAPIServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HeartbeatAPIServer will result in compilation errors.

Jump to

Keyboard shortcuts

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