cluster

package
v4.25.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 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

View Source
const (
	Cluster_ClusterInfo_FullMethodName = "/cluster.Cluster/ClusterInfo"
)

Variables

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

Enum value maps for Status.

View Source
var Cluster_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "cluster.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 *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error)
}

ClusterClient is the client API for Cluster service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.golang.ir/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewClusterClient

func NewClusterClient(cc grpc.ClientConnInterface) ClusterClient

type ClusterServer

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

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

type InfoRequest

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

func (*InfoRequest) Descriptor deprecated

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

Deprecated: Use InfoRequest.ProtoReflect.Descriptor instead.

func (*InfoRequest) ProtoMessage

func (*InfoRequest) ProtoMessage()

func (*InfoRequest) ProtoReflect

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

func (*InfoRequest) Reset

func (x *InfoRequest) Reset()

func (*InfoRequest) String

func (x *InfoRequest) String() string

func (*InfoRequest) Validate

func (m *InfoRequest) Validate() error

Validate checks the field values on InfoRequest 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 (*InfoRequest) ValidateAll

func (m *InfoRequest) ValidateAll() error

ValidateAll checks the field values on InfoRequest 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 InfoRequestMultiError, or nil if none found.

type InfoRequestMultiError

type InfoRequestMultiError []error

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

func (InfoRequestMultiError) AllErrors

func (m InfoRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (InfoRequestMultiError) Error

func (m InfoRequestMultiError) Error() string

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

type InfoRequestValidationError

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

InfoRequestValidationError is the validation error returned by InfoRequest.Validate if the designated constraints aren't met.

func (InfoRequestValidationError) Cause

Cause function returns cause value.

func (InfoRequestValidationError) Error

Error satisfies the builtin error interface

func (InfoRequestValidationError) ErrorName

func (e InfoRequestValidationError) ErrorName() string

ErrorName returns error name.

func (InfoRequestValidationError) Field

Field function returns field value.

func (InfoRequestValidationError) Key

Key function returns key value.

func (InfoRequestValidationError) Reason

Reason function returns reason value.

type InfoResponse

type InfoResponse 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 (*InfoResponse) Descriptor deprecated

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

Deprecated: Use InfoResponse.ProtoReflect.Descriptor instead.

func (*InfoResponse) GetFreeCpu

func (x *InfoResponse) GetFreeCpu() string

func (*InfoResponse) GetFreeMemory

func (x *InfoResponse) GetFreeMemory() string

func (*InfoResponse) GetFreeRequestCpu

func (x *InfoResponse) GetFreeRequestCpu() string

func (*InfoResponse) GetFreeRequestMemory

func (x *InfoResponse) GetFreeRequestMemory() string

func (*InfoResponse) GetRequestCpuRate

func (x *InfoResponse) GetRequestCpuRate() string

func (*InfoResponse) GetRequestMemoryRate

func (x *InfoResponse) GetRequestMemoryRate() string

func (*InfoResponse) GetStatus

func (x *InfoResponse) GetStatus() string

func (*InfoResponse) GetTotalCpu

func (x *InfoResponse) GetTotalCpu() string

func (*InfoResponse) GetTotalMemory

func (x *InfoResponse) GetTotalMemory() string

func (*InfoResponse) GetUsageCpuRate

func (x *InfoResponse) GetUsageCpuRate() string

func (*InfoResponse) GetUsageMemoryRate

func (x *InfoResponse) GetUsageMemoryRate() string

func (*InfoResponse) ProtoMessage

func (*InfoResponse) ProtoMessage()

func (*InfoResponse) ProtoReflect

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

func (*InfoResponse) Reset

func (x *InfoResponse) Reset()

func (*InfoResponse) String

func (x *InfoResponse) String() string

func (*InfoResponse) Validate

func (m *InfoResponse) Validate() error

Validate checks the field values on InfoResponse 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 (*InfoResponse) ValidateAll

func (m *InfoResponse) ValidateAll() error

ValidateAll checks the field values on InfoResponse 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 InfoResponseMultiError, or nil if none found.

type InfoResponseMultiError

type InfoResponseMultiError []error

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

func (InfoResponseMultiError) AllErrors

func (m InfoResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (InfoResponseMultiError) Error

func (m InfoResponseMultiError) Error() string

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

type InfoResponseValidationError

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

InfoResponseValidationError is the validation error returned by InfoResponse.Validate if the designated constraints aren't met.

func (InfoResponseValidationError) Cause

Cause function returns cause value.

func (InfoResponseValidationError) Error

Error satisfies the builtin error interface

func (InfoResponseValidationError) ErrorName

func (e InfoResponseValidationError) ErrorName() string

ErrorName returns error name.

func (InfoResponseValidationError) Field

Field function returns field value.

func (InfoResponseValidationError) Key

Key function returns key value.

func (InfoResponseValidationError) Reason

Reason function returns reason value.

type Status

type Status int32
const (
	Status_StatusUnknown Status = 0
	Status_StatusBad     Status = 1
	Status_StatusNotGood Status = 2
	Status_StatusHealth  Status = 3
)

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

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