ServiceManage

package
v0.0.0-...-d15be54 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

服务模块

获取服务

客户端服务注册

客户端服务发现

客户端服务注销

客户端服务续约

客户端指标上报

Documentation

Index

Constants

View Source
const (
	AppName = "ServiceManage"
)
View Source
const (
	ServiceManage_RecoverService_FullMethodName = "/ServiceManage/RecoverService"
)

Variables

View Source
var File_ServiceManage_proto protoreflect.FileDescriptor
View Source
var ServiceManage_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "ServiceManage",
	HandlerType: (*ServiceManageServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "RecoverService",
			Handler:    _ServiceManage_RecoverService_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "ServiceManage.proto",
}

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

Functions

func RegisterServiceManageServer

func RegisterServiceManageServer(s grpc.ServiceRegistrar, srv ServiceManageServer)

Types

type AllServices

type AllServices struct {
	ServiceInstances []map[string]map[string][]string `json:"service_instances"` //map[projectname: string]{map[servicename: string]:[{service: string...}]}
}

func (*AllServices) String

func (a *AllServices) String() string

type IsPriority

type IsPriority struct {
	Priority bool `json:"priority"`
}

type Service

type Service struct {
	ProjectName string `json:"project_name"` //项目名
	ServiceName string `json:"service_name"` //服务名
	ServiceHost string `json:"service_host"` //服务地址
}

type ServiceHost

type ServiceHost struct {
	ServiceHost string `protobuf:"bytes,1,opt,name=ServiceHost,proto3" json:"ServiceHost,omitempty"`
	// contains filtered or unexported fields
}

func (*ServiceHost) Descriptor deprecated

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

Deprecated: Use ServiceHost.ProtoReflect.Descriptor instead.

func (*ServiceHost) GetServiceHost

func (x *ServiceHost) GetServiceHost() string

func (*ServiceHost) ProtoMessage

func (*ServiceHost) ProtoMessage()

func (*ServiceHost) ProtoReflect

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

func (*ServiceHost) Reset

func (x *ServiceHost) Reset()

func (*ServiceHost) String

func (x *ServiceHost) String() string

type ServiceManage

type ServiceManage interface {
	//TODO implement 获取服务状态
	FetchServiceStatus(ctx context.Context, service *Service) (*IsPriority, error)
	//TODO implement 获取服务信息
	FetchServiceInfo(ctx context.Context) (*AllServices, error)
	//TODO implement http 服务注销
	UnRegisterService(ctx context.Context, Service *Service) error
	//TODO implement http 指定服务为最优
	SetBestService(ctx context.Context, Service *Service) error
	//TODO implement http 指定服务为不是优
	UnSetBestService(ctx context.Context, Service *Service) error
	//TODO 获取指定服务2小时的指标
	FetchMetricsForServiceLastTwoHour(ctx context.Context, service *Service) (*TimeSeriesData, error)
	//TODO 取指定服务的6小时内的指标
	FetchMetricsForServiceLastSixHour(ctx context.Context, service *Service) (*TimeSeriesData, error)
	//TODO  获取指定服务12小时内的指标
	FetchMetricsForServiceRecent(ctx context.Context, service *Service) (*TimeSeriesData, error)
	//TODO 获取指定服务24小时内的指标
	FetchServiceMetricsForLastDay(ctx context.Context, service *Service) (*TimeSeriesData, error)
}

type ServiceManageClient

type ServiceManageClient interface {
	// 服务发现  获取最佳节点地址
	RecoverService(ctx context.Context, in *ServicePrefix, opts ...grpc.CallOption) (*ServiceHost, error)
}

ServiceManageClient is the client API for ServiceManage 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 ServiceManageServer

type ServiceManageServer interface {
	// 服务发现  获取最佳节点地址
	RecoverService(context.Context, *ServicePrefix) (*ServiceHost, error)
	// contains filtered or unexported methods
}

ServiceManageServer is the server API for ServiceManage service. All implementations must embed UnimplementedServiceManageServer for forward compatibility

type ServicePrefix

type ServicePrefix struct {
	ServicePrefix string `protobuf:"bytes,1,opt,name=ServiceName,proto3" json:"ServiceName,omitempty"`
	// contains filtered or unexported fields
}

func (*ServicePrefix) Descriptor deprecated

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

Deprecated: Use ServiceName.ProtoReflect.Descriptor instead.

func (*ServicePrefix) GetServicePrefix

func (x *ServicePrefix) GetServicePrefix() string

func (*ServicePrefix) ProtoMessage

func (*ServicePrefix) ProtoMessage()

func (*ServicePrefix) ProtoReflect

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

func (*ServicePrefix) Reset

func (x *ServicePrefix) Reset()

func (*ServicePrefix) String

func (x *ServicePrefix) String() string

type TimeSeriesData

type TimeSeriesData struct {
	Timestamps   []string  `json:"timestamps"`
	CpuUsages    []float64 `json:"cpuUsages"`
	MemoryUsages []float64 `json:"memoryUsages"`
	IcmpDelays   []int64   `json:"icmpDelays"`
}

func (*TimeSeriesData) String

func (a *TimeSeriesData) String() string

type UnimplementedServiceManageServer

type UnimplementedServiceManageServer struct {
}

UnimplementedServiceManageServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceManageServer) RecoverService

type UnsafeServiceManageServer

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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