cluster

package
v0.0.0-...-51115e0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Overview

Package cluster is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ClusterStatus_name = map[int32]string{
		0: "StatusUnknown",
		1: "StatusBad",
		2: "StatusNotGood",
		3: "StatusHealth",
	}
	ClusterStatus_value = map[string]int32{
		"StatusUnknown": 0,
		"StatusBad":     1,
		"StatusNotGood": 2,
		"StatusHealth":  3,
	}
)

Enum value maps for ClusterStatus.

View Source
var Cluster_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Cluster",
	HandlerType: (*ClusterServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ClusterInfo",
			Handler:    _Cluster_ClusterInfo_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "cluster/cluster.proto",
}

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

View Source
var File_cluster_cluster_proto protoreflect.FileDescriptor

Functions

func RegisterClusterHandler

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

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

func RegisterClusterHandlerClient

func RegisterClusterHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ClusterClient) error

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

func RegisterClusterHandlerFromEndpoint

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

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

func RegisterClusterHandlerServer

func RegisterClusterHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ClusterServer) error

RegisterClusterHandlerServer registers the http handlers for service Cluster to "mux". UnaryRPC :call ClusterServer 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 RegisterClusterHandlerFromEndpoint instead.

func RegisterClusterServer

func RegisterClusterServer(s grpc.ServiceRegistrar, srv ClusterServer)

Types

type ClusterClient

type ClusterClient interface {
	// ClusterInfo 查看集群信息
	ClusterInfo(ctx context.Context, in *ClusterInfoRequest, opts ...grpc.CallOption) (*ClusterInfoResponse, error)
}

ClusterClient is the client API for Cluster 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 NewClusterClient

func NewClusterClient(cc grpc.ClientConnInterface) ClusterClient

type ClusterInfoRequest

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

func (*ClusterInfoRequest) Descriptor deprecated

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

Deprecated: Use ClusterInfoRequest.ProtoReflect.Descriptor instead.

func (*ClusterInfoRequest) ProtoMessage

func (*ClusterInfoRequest) ProtoMessage()

func (*ClusterInfoRequest) ProtoReflect

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

func (*ClusterInfoRequest) Reset

func (x *ClusterInfoRequest) Reset()

func (*ClusterInfoRequest) String

func (x *ClusterInfoRequest) String() string

func (*ClusterInfoRequest) Validate

func (m *ClusterInfoRequest) Validate() error

Validate checks the field values on ClusterInfoRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*ClusterInfoRequest) ValidateAll

func (m *ClusterInfoRequest) ValidateAll() error

ValidateAll checks the field values on ClusterInfoRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ClusterInfoRequestMultiError, or nil if none found.

type ClusterInfoRequestMultiError

type ClusterInfoRequestMultiError []error

ClusterInfoRequestMultiError is an error wrapping multiple validation errors returned by ClusterInfoRequest.ValidateAll() if the designated constraints aren't met.

func (ClusterInfoRequestMultiError) AllErrors

func (m ClusterInfoRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ClusterInfoRequestMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type ClusterInfoRequestValidationError

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

ClusterInfoRequestValidationError is the validation error returned by ClusterInfoRequest.Validate if the designated constraints aren't met.

func (ClusterInfoRequestValidationError) Cause

Cause function returns cause value.

func (ClusterInfoRequestValidationError) Error

Error satisfies the builtin error interface

func (ClusterInfoRequestValidationError) ErrorName

ErrorName returns error name.

func (ClusterInfoRequestValidationError) Field

Field function returns field value.

func (ClusterInfoRequestValidationError) Key

Key function returns key value.

func (ClusterInfoRequestValidationError) Reason

Reason function returns reason value.

type ClusterInfoResponse

type ClusterInfoResponse struct {
	Status            string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
	FreeMemory        string `protobuf:"bytes,2,opt,name=free_memory,json=freeMemory,proto3" json:"free_memory,omitempty"`
	FreeCpu           string `protobuf:"bytes,3,opt,name=free_cpu,json=freeCpu,proto3" json:"free_cpu,omitempty"`
	FreeRequestMemory string `protobuf:"bytes,4,opt,name=free_request_memory,json=freeRequestMemory,proto3" json:"free_request_memory,omitempty"`
	FreeRequestCpu    string `protobuf:"bytes,5,opt,name=free_request_cpu,json=freeRequestCpu,proto3" json:"free_request_cpu,omitempty"`
	TotalMemory       string `protobuf:"bytes,6,opt,name=total_memory,json=totalMemory,proto3" json:"total_memory,omitempty"`
	TotalCpu          string `protobuf:"bytes,7,opt,name=total_cpu,json=totalCpu,proto3" json:"total_cpu,omitempty"`
	UsageMemoryRate   string `protobuf:"bytes,8,opt,name=usage_memory_rate,json=usageMemoryRate,proto3" json:"usage_memory_rate,omitempty"`
	UsageCpuRate      string `protobuf:"bytes,9,opt,name=usage_cpu_rate,json=usageCpuRate,proto3" json:"usage_cpu_rate,omitempty"`
	RequestMemoryRate string `protobuf:"bytes,10,opt,name=request_memory_rate,json=requestMemoryRate,proto3" json:"request_memory_rate,omitempty"`
	RequestCpuRate    string `protobuf:"bytes,11,opt,name=request_cpu_rate,json=requestCpuRate,proto3" json:"request_cpu_rate,omitempty"`
	// contains filtered or unexported fields
}

func (*ClusterInfoResponse) Descriptor deprecated

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

Deprecated: Use ClusterInfoResponse.ProtoReflect.Descriptor instead.

func (*ClusterInfoResponse) GetFreeCpu

func (x *ClusterInfoResponse) GetFreeCpu() string

func (*ClusterInfoResponse) GetFreeMemory

func (x *ClusterInfoResponse) GetFreeMemory() string

func (*ClusterInfoResponse) GetFreeRequestCpu

func (x *ClusterInfoResponse) GetFreeRequestCpu() string

func (*ClusterInfoResponse) GetFreeRequestMemory

func (x *ClusterInfoResponse) GetFreeRequestMemory() string

func (*ClusterInfoResponse) GetRequestCpuRate

func (x *ClusterInfoResponse) GetRequestCpuRate() string

func (*ClusterInfoResponse) GetRequestMemoryRate

func (x *ClusterInfoResponse) GetRequestMemoryRate() string

func (*ClusterInfoResponse) GetStatus

func (x *ClusterInfoResponse) GetStatus() string

func (*ClusterInfoResponse) GetTotalCpu

func (x *ClusterInfoResponse) GetTotalCpu() string

func (*ClusterInfoResponse) GetTotalMemory

func (x *ClusterInfoResponse) GetTotalMemory() string

func (*ClusterInfoResponse) GetUsageCpuRate

func (x *ClusterInfoResponse) GetUsageCpuRate() string

func (*ClusterInfoResponse) GetUsageMemoryRate

func (x *ClusterInfoResponse) GetUsageMemoryRate() string

func (*ClusterInfoResponse) ProtoMessage

func (*ClusterInfoResponse) ProtoMessage()

func (*ClusterInfoResponse) ProtoReflect

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

func (*ClusterInfoResponse) Reset

func (x *ClusterInfoResponse) Reset()

func (*ClusterInfoResponse) String

func (x *ClusterInfoResponse) String() string

func (*ClusterInfoResponse) Validate

func (m *ClusterInfoResponse) Validate() error

Validate checks the field values on ClusterInfoResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*ClusterInfoResponse) ValidateAll

func (m *ClusterInfoResponse) ValidateAll() error

ValidateAll checks the field values on ClusterInfoResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ClusterInfoResponseMultiError, or nil if none found.

type ClusterInfoResponseMultiError

type ClusterInfoResponseMultiError []error

ClusterInfoResponseMultiError is an error wrapping multiple validation errors returned by ClusterInfoResponse.ValidateAll() if the designated constraints aren't met.

func (ClusterInfoResponseMultiError) AllErrors

func (m ClusterInfoResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ClusterInfoResponseMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type ClusterInfoResponseValidationError

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

ClusterInfoResponseValidationError is the validation error returned by ClusterInfoResponse.Validate if the designated constraints aren't met.

func (ClusterInfoResponseValidationError) Cause

Cause function returns cause value.

func (ClusterInfoResponseValidationError) Error

Error satisfies the builtin error interface

func (ClusterInfoResponseValidationError) ErrorName

ErrorName returns error name.

func (ClusterInfoResponseValidationError) Field

Field function returns field value.

func (ClusterInfoResponseValidationError) Key

Key function returns key value.

func (ClusterInfoResponseValidationError) Reason

Reason function returns reason value.

type ClusterServer

type ClusterServer interface {
	// ClusterInfo 查看集群信息
	ClusterInfo(context.Context, *ClusterInfoRequest) (*ClusterInfoResponse, error)
	// contains filtered or unexported methods
}

ClusterServer is the server API for Cluster service. All implementations must embed UnimplementedClusterServer for forward compatibility

type ClusterStatus

type ClusterStatus int32
const (
	ClusterStatus_StatusUnknown ClusterStatus = 0
	ClusterStatus_StatusBad     ClusterStatus = 1
	ClusterStatus_StatusNotGood ClusterStatus = 2
	ClusterStatus_StatusHealth  ClusterStatus = 3
)

func (ClusterStatus) Descriptor

func (ClusterStatus) Enum

func (x ClusterStatus) Enum() *ClusterStatus

func (ClusterStatus) EnumDescriptor deprecated

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

Deprecated: Use ClusterStatus.Descriptor instead.

func (ClusterStatus) Number

func (ClusterStatus) String

func (x ClusterStatus) String() string

func (ClusterStatus) Type

type UnimplementedClusterServer

type UnimplementedClusterServer struct {
}

UnimplementedClusterServer must be embedded to have forward compatible implementations.

func (UnimplementedClusterServer) ClusterInfo

type UnsafeClusterServer

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

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

Jump to

Keyboard shortcuts

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