instance

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultRegion      = "default"
	DefaultEnvironment = "default"
	DefaultGroup       = "default"
)
View Source
const (
	AppName = "instance"
)

Variables

View Source
var (
	Protocal_name = map[int32]string{
		0: "GRPC",
		1: "HTTP",
	}
	Protocal_value = map[string]int32{
		"GRPC": 0,
		"HTTP": 1,
	}
)

Enum value maps for Protocal.

View Source
var (
	Provider_name = map[int32]string{
		0: "SDK",
		1: "KUBERNETES",
	}
	Provider_value = map[string]int32{
		"SDK":        0,
		"KUBERNETES": 1,
	}
)

Enum value maps for Provider.

View Source
var (
	CommandType_name = map[int32]string{
		0: "UPDATE_INSTANCE",
	}
	CommandType_value = map[string]int32{
		"UPDATE_INSTANCE": 0,
	}
)

Enum value maps for CommandType.

View Source
var File_apps_instance_pb_instance_impl_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "gitee.com.MinKoU.mcenter.instance.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "RegistryInstance",
			Handler:    _Service_RegistryInstance_Handler,
		},
		{
			MethodName: "UnRegistry",
			Handler:    _Service_UnRegistry_Handler,
		},
		{
			MethodName: "Search",
			Handler:    _Service_Search_Handler,
		},
		{
			MethodName: "DescribeInstance",
			Handler:    _Service_DescribeInstance_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Heartbeat",
			Handler:       _Service_Heartbeat_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "apps/instance/pb/instance_impl.proto",
}

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

Functions

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type Build

type Build struct {

	// 实例版本
	// @gotags: bson:"version" json:"version" toml:"version" yaml:"version" env:"MCENTER_BUILD_VERSION"
	Version string `` /* 130-byte string literal not displayed */
	// 实例代码构建对应分支
	// @gotags: bson:"git_branch" json:"git_branch" toml:"git_branch" yaml:"git_branch" env:"MCENTER_BUILD_GIT_BRANCH"
	GitBranch string `` /* 163-byte string literal not displayed */
	// 实例代码对应commit号
	// @gotags: bson:"git_commit" json:"git_commit" toml:"git_commit" yaml:"git_commit" env:"MCENTER_BUILD_GIT_COMMIT"
	GitCommit string `` /* 163-byte string literal not displayed */
	// 实例构建时间
	// @gotags: bson:"build_at" json:"build_at" toml:"build_at" yaml:"build_at" env:"MCENTER_BUILD_AT"
	BuildAt int64 `` /* 144-byte string literal not displayed */
	// contains filtered or unexported fields
}

实例构建相关信息

func (*Build) Descriptor deprecated

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

Deprecated: Use Build.ProtoReflect.Descriptor instead.

func (*Build) GetBuildAt

func (x *Build) GetBuildAt() int64

func (*Build) GetGitBranch

func (x *Build) GetGitBranch() string

func (*Build) GetGitCommit

func (x *Build) GetGitCommit() string

func (*Build) GetVersion

func (x *Build) GetVersion() string

func (*Build) ProtoMessage

func (*Build) ProtoMessage()

func (*Build) ProtoReflect

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

func (*Build) Reset

func (x *Build) Reset()

func (*Build) String

func (x *Build) String() string

type CommandType

type CommandType int32
const (
	CommandType_UPDATE_INSTANCE CommandType = 0
)

func (CommandType) Descriptor

func (CommandType) Enum

func (x CommandType) Enum() *CommandType

func (CommandType) EnumDescriptor deprecated

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

Deprecated: Use CommandType.Descriptor instead.

func (CommandType) Number

func (x CommandType) Number() protoreflect.EnumNumber

func (CommandType) String

func (x CommandType) String() string

func (CommandType) Type

type Config

type Config struct {

	// 心跳设置
	// @gotags: bson:"heart_beat" json:"heart_beat"
	Heartbeat *HeartbeatConfig `protobuf:"bytes,1,opt,name=heartbeat,proto3" json:"heart_beat" bson:"heart_beat"`
	// contains filtered or unexported fields
}

func NewDefaultConfig

func NewDefaultConfig() *Config

func (*Config) Descriptor deprecated

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

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetHeartbeat

func (x *Config) GetHeartbeat() *HeartbeatConfig

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

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

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type DescribeInstanceRequest

type DescribeInstanceRequest struct {

	// 实例的Id
	// @gotags: json:"id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
	// contains filtered or unexported fields
}

func NewDescribeInstanceRequest

func NewDescribeInstanceRequest(id string) *DescribeInstanceRequest

func (*DescribeInstanceRequest) Descriptor deprecated

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

Deprecated: Use DescribeInstanceRequest.ProtoReflect.Descriptor instead.

func (*DescribeInstanceRequest) GetId

func (x *DescribeInstanceRequest) GetId() string

func (*DescribeInstanceRequest) ProtoMessage

func (*DescribeInstanceRequest) ProtoMessage()

func (*DescribeInstanceRequest) ProtoReflect

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

func (*DescribeInstanceRequest) Reset

func (x *DescribeInstanceRequest) Reset()

func (*DescribeInstanceRequest) String

func (x *DescribeInstanceRequest) String() string

type HeartbeatConfig

type HeartbeatConfig struct {

	// 心跳间隔
	// @gotags: bson:"interval" json:"interval"
	Interval int32 `protobuf:"varint,1,opt,name=interval,proto3" json:"interval" bson:"interval"`
	// 心跳超时时间, 单位秒
	// @gotags: bson:"timeout" json:"timeout"
	Timeout int32 `protobuf:"varint,2,opt,name=timeout,proto3" json:"timeout" bson:"timeout"`
	// contains filtered or unexported fields
}

func (*HeartbeatConfig) Descriptor deprecated

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

Deprecated: Use HeartbeatConfig.ProtoReflect.Descriptor instead.

func (*HeartbeatConfig) GetInterval

func (x *HeartbeatConfig) GetInterval() int32

func (*HeartbeatConfig) GetTimeout

func (x *HeartbeatConfig) GetTimeout() int32

func (*HeartbeatConfig) ProtoMessage

func (*HeartbeatConfig) ProtoMessage()

func (*HeartbeatConfig) ProtoReflect

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

func (*HeartbeatConfig) Reset

func (x *HeartbeatConfig) Reset()

func (*HeartbeatConfig) String

func (x *HeartbeatConfig) String() string

type HeartbeatRequest

type HeartbeatRequest struct {

	// 实例Id
	// @gotags: bson:"instance_id" json:"instance_id"
	InstanceId string `protobuf:"bytes,1,opt,name=instance_id,json=instanceId,proto3" json:"instance_id" bson:"instance_id"`
	// contains filtered or unexported fields
}

func NewHeartbeatRequest

func NewHeartbeatRequest(id string) *HeartbeatRequest

func (*HeartbeatRequest) Descriptor deprecated

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

Deprecated: Use HeartbeatRequest.ProtoReflect.Descriptor instead.

func (*HeartbeatRequest) GetInstanceId

func (x *HeartbeatRequest) GetInstanceId() string

func (*HeartbeatRequest) ProtoMessage

func (*HeartbeatRequest) ProtoMessage()

func (*HeartbeatRequest) ProtoReflect

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

func (*HeartbeatRequest) Reset

func (x *HeartbeatRequest) Reset()

func (*HeartbeatRequest) String

func (x *HeartbeatRequest) String() string

type HeartbeatResponse

type HeartbeatResponse struct {

	// 客户端下一次心跳包的发送间隔, 单位秒
	// @gotags: bson:"next" json:"next"
	Next int32 `protobuf:"varint,1,opt,name=next,proto3" json:"next" bson:"next"`
	// 客户端需要执行命令
	// @gotags: bson:"remote_command" json:"remote_command"
	RemoteCommand *RemoteCommand `protobuf:"bytes,2,opt,name=remote_command,json=remoteCommand,proto3" json:"remote_command" bson:"remote_command"`
	// contains filtered or unexported fields
}

func NewHeartbeatResponse

func NewHeartbeatResponse() *HeartbeatResponse

func (*HeartbeatResponse) Descriptor deprecated

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

Deprecated: Use HeartbeatResponse.ProtoReflect.Descriptor instead.

func (*HeartbeatResponse) GetNext

func (x *HeartbeatResponse) GetNext() int32

func (*HeartbeatResponse) GetRemoteCommand

func (x *HeartbeatResponse) GetRemoteCommand() *RemoteCommand

func (*HeartbeatResponse) ProtoMessage

func (*HeartbeatResponse) ProtoMessage()

func (*HeartbeatResponse) ProtoReflect

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

func (*HeartbeatResponse) Reset

func (x *HeartbeatResponse) Reset()

func (*HeartbeatResponse) String

func (x *HeartbeatResponse) String() string

type Instance

type Instance struct {

	// 服务所属域
	// @gotags: bson:"_id" json:"id"
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"`
	// 服务所属域
	// @gotags: bson:"domain" json:"domain"
	Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain" bson:"domain"`
	// 服务所属空间
	// @gotags: bson:"namespace" json:"namespace"
	Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace" bson:"namespace"`
	// 实例所属应用名称
	// @gotags: bson:"service_name" json:"service_name"
	ServiceName string `protobuf:"bytes,4,opt,name=service_name,json=serviceName,proto3" json:"service_name" bson:"service_name"`
	// 实例注册相关信息
	// @gotags: bson:"registry_info" json:"registry_info"
	RegistryInfo *RegistryRequest `protobuf:"bytes,5,opt,name=registry_info,json=registryInfo,proto3" json:"registry_info" bson:"registry_info"`
	// 实例状态
	// @gotags: bson:"status" json:"status"
	Status *Status `protobuf:"bytes,6,opt,name=status,proto3" json:"status" bson:"status"`
	// 实例配置
	// @gotags: bson:"config" json:"config"
	Config *Config `protobuf:"bytes,7,opt,name=config,proto3" json:"config" bson:"config"`
	// contains filtered or unexported fields
}

服务实例信息, 比如 阿里云_杭州/生产环境/app01/default/instance01

func NewDefaultInstance

func NewDefaultInstance() *Instance

func NewInstance

func NewInstance(req *RegistryRequest, app *service.Service) (*Instance, error)

func (*Instance) Descriptor deprecated

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

Deprecated: Use Instance.ProtoReflect.Descriptor instead.

func (*Instance) FullName

func (i *Instance) FullName() string

func (*Instance) GetConfig

func (x *Instance) GetConfig() *Config

func (*Instance) GetDomain

func (x *Instance) GetDomain() string

func (*Instance) GetId

func (x *Instance) GetId() string

func (*Instance) GetNamespace

func (x *Instance) GetNamespace() string

func (*Instance) GetRegistryInfo

func (x *Instance) GetRegistryInfo() *RegistryRequest

func (*Instance) GetServiceName

func (x *Instance) GetServiceName() string

func (*Instance) GetStatus

func (x *Instance) GetStatus() *Status

func (*Instance) ProtoMessage

func (*Instance) ProtoMessage()

func (*Instance) ProtoReflect

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

func (*Instance) Reset

func (x *Instance) Reset()

func (*Instance) String

func (x *Instance) String() string

type InstanceSet

type InstanceSet struct {

	// 总个数
	// @gotags: bson:"status" json:"status"
	Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"status" bson:"status"`
	// 实例列表
	// @gotags: bson:"items" json:"items"
	Items []*Instance `protobuf:"bytes,2,rep,name=items,proto3" json:"items" bson:"items"`
	// contains filtered or unexported fields
}

func NewInstanceSet

func NewInstanceSet() *InstanceSet

func (*InstanceSet) Add

func (s *InstanceSet) Add(ins *Instance)

func (*InstanceSet) Descriptor deprecated

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

Deprecated: Use InstanceSet.ProtoReflect.Descriptor instead.

func (*InstanceSet) GetGroupInstance

func (s *InstanceSet) GetGroupInstance(group string) (items []*Instance)

func (*InstanceSet) GetItems

func (x *InstanceSet) GetItems() []*Instance

func (*InstanceSet) GetOldGroup

func (s *InstanceSet) GetOldGroup() (items []*Instance)

func (*InstanceSet) GetTotal

func (x *InstanceSet) GetTotal() int64

func (*InstanceSet) Len

func (s *InstanceSet) Len() int

func (*InstanceSet) Less

func (s *InstanceSet) Less(i, j int) bool

func (*InstanceSet) ProtoMessage

func (*InstanceSet) ProtoMessage()

func (*InstanceSet) ProtoReflect

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

func (*InstanceSet) Reset

func (x *InstanceSet) Reset()

func (*InstanceSet) String

func (x *InstanceSet) String() string

func (*InstanceSet) Swap

func (s *InstanceSet) Swap(i, j int)

type Protocal

type Protocal int32

实例注册的协议类型

const (
	// GRPC服务
	Protocal_GRPC Protocal = 0
	// HTTP服务
	Protocal_HTTP Protocal = 1
)

func (Protocal) Descriptor

func (Protocal) Descriptor() protoreflect.EnumDescriptor

func (Protocal) Enum

func (x Protocal) Enum() *Protocal

func (Protocal) EnumDescriptor deprecated

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

Deprecated: Use Protocal.Descriptor instead.

func (Protocal) Number

func (x Protocal) Number() protoreflect.EnumNumber

func (Protocal) String

func (x Protocal) String() string

func (Protocal) Type

type Provider

type Provider int32
const (
	// SDK直接注册
	Provider_SDK Provider = 0
	// 服务来源于kubernetes, 有operator提供注册
	Provider_KUBERNETES Provider = 1
)

func (Provider) Descriptor

func (Provider) Descriptor() protoreflect.EnumDescriptor

func (Provider) Enum

func (x Provider) Enum() *Provider

func (Provider) EnumDescriptor deprecated

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

Deprecated: Use Provider.Descriptor instead.

func (Provider) Number

func (x Provider) Number() protoreflect.EnumNumber

func (Provider) String

func (x Provider) String() string

func (Provider) Type

type RegistryRequest

type RegistryRequest struct {

	// 提供注册提供方
	// @gotags: bson:"provider" json:"provider" toml:"provider" yaml:"provider" env:"MCENTER_PROVIDER"
	Provider Provider `` /* 179-byte string literal not displayed */
	// 实例所属地域, 默认default
	// @gotags: bson:"region" json:"region" toml:"region" yaml:"region" env:"MCENTER_REGION" validate:"required"
	Region string `` /* 138-byte string literal not displayed */
	// 实例所属环境, 默认default
	// @gotags: bson:"environment" json:"environment" toml:"environment" yaml:"environment" env:"MCENTER_ENV" validate:"required"
	Environment string `` /* 160-byte string literal not displayed */
	// 实例所属分组,默认default
	// @gotags: bson:"group" json:"group" toml:"group" yaml:"group" env:"MCENTER_GROUP" validate:"required"
	Group string `` /* 132-byte string literal not displayed */
	// 实例名称, 如果不传, 则会随机生成
	// @gotags: bson:"name" json:"name" toml:"name" yaml:"name" env:"MCENTER_NAME"
	Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name" bson:"name" toml:"name" yaml:"name" env:"MCENTER_NAME"`
	// 注册的对外的访问的协议
	// @gotags: bson:"protocal" json:"protocal" toml:"protocal" yaml:"protocal" env:"MCENTER_PROTOCAL"
	Protocal Protocal `` /* 179-byte string literal not displayed */
	// 实例地址
	// @gotags: bson:"address" json:"address" toml:"address" yaml:"address" env:"MCENTER_ADDRESS" validate:"required"
	Address string `` /* 144-byte string literal not displayed */
	// 该地址是否对外暴露, 如果暴露, 会被注册到网关
	// @gotags: bson:"export" json:"export" toml:"export" yaml:"export" env:"MCENTER_EXPORT"
	Export bool `protobuf:"varint,8,opt,name=export,proto3" json:"export" bson:"export" toml:"export" yaml:"export" env:"MCENTER_EXPORT"`
	// 实例标签, 可以根据标签快速过滤实例
	// @gotags: bson:"tags" json:"tags" toml:"tags" yaml:"tags" env:"MCENTER_TAGS"
	Tags map[string]string `` /* 194-byte string literal not displayed */
	// 实例构建信息
	// @gotags: bson:"build" json:"build" toml:"build" yaml:"build"
	Build *Build `protobuf:"bytes,10,opt,name=build,proto3" json:"build" bson:"build" toml:"build" yaml:"build"`
	// contains filtered or unexported fields
}

func NewRegistryRequest

func NewRegistryRequest() *RegistryRequest

func (*RegistryRequest) Descriptor deprecated

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

Deprecated: Use RegistryRequest.ProtoReflect.Descriptor instead.

func (*RegistryRequest) GetAddress

func (x *RegistryRequest) GetAddress() string

func (*RegistryRequest) GetBuild

func (x *RegistryRequest) GetBuild() *Build

func (*RegistryRequest) GetEnvironment

func (x *RegistryRequest) GetEnvironment() string

func (*RegistryRequest) GetExport

func (x *RegistryRequest) GetExport() bool

func (*RegistryRequest) GetGroup

func (x *RegistryRequest) GetGroup() string

func (*RegistryRequest) GetName

func (x *RegistryRequest) GetName() string

func (*RegistryRequest) GetProtocal

func (x *RegistryRequest) GetProtocal() Protocal

func (*RegistryRequest) GetProvider

func (x *RegistryRequest) GetProvider() Provider

func (*RegistryRequest) GetRegion

func (x *RegistryRequest) GetRegion() string

func (*RegistryRequest) GetTags

func (x *RegistryRequest) GetTags() map[string]string

func (*RegistryRequest) InstanceFullName

func (r *RegistryRequest) InstanceFullName() string

func (*RegistryRequest) ProtoMessage

func (*RegistryRequest) ProtoMessage()

func (*RegistryRequest) ProtoReflect

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

func (*RegistryRequest) Reset

func (x *RegistryRequest) Reset()

func (*RegistryRequest) String

func (x *RegistryRequest) String() string

func (*RegistryRequest) Validate

func (r *RegistryRequest) Validate() error

type RemoteCommand

type RemoteCommand struct {

	// 客户端需要执行命令类型
	// @gotags: bson:"type" json:"type"
	Type CommandType `protobuf:"varint,1,opt,name=type,proto3,enum=gitee.com.MinKoU.mcenter.instance.CommandType" json:"type" bson:"type"`
	// 指令参数
	// @gotags: bson:"params" json:"params"
	Params map[string]string `` /* 157-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*RemoteCommand) Descriptor deprecated

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

Deprecated: Use RemoteCommand.ProtoReflect.Descriptor instead.

func (*RemoteCommand) GetParams

func (x *RemoteCommand) GetParams() map[string]string

func (*RemoteCommand) GetType

func (x *RemoteCommand) GetType() CommandType

func (*RemoteCommand) ProtoMessage

func (*RemoteCommand) ProtoMessage()

func (*RemoteCommand) ProtoReflect

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

func (*RemoteCommand) Reset

func (x *RemoteCommand) Reset()

func (*RemoteCommand) String

func (x *RemoteCommand) String() string

type SearchRequest

type SearchRequest struct {

	// 分页参数
	// @gotags: json:"page"
	Page *request.PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"`
	// 服务所属域
	// @gotags: bson:"domain" json:"domain" validate:"required"
	Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain" bson:"domain" validate:"required"`
	// 服务所属空间
	// @gotags: bson:"namespace" json:"namespace"
	Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace" bson:"namespace"`
	// 实例所属应用Id
	// @gotags: bson:"service_name" json:"service_name"
	ServiceName string `protobuf:"bytes,4,opt,name=service_name,json=serviceName,proto3" json:"service_name" bson:"service_name"`
	// 实例所属环境, 默认default
	// @gotags: bson:"region" json:"region"
	Region string `protobuf:"bytes,5,opt,name=region,proto3" json:"region" bson:"region"`
	// 实例所属环境, 默认default
	// @gotags: bson:"environment" json:"environment"
	Environment string `protobuf:"bytes,6,opt,name=environment,proto3" json:"environment" bson:"environment"`
	// 实例所属分组,默认default
	// @gotags: bson:"group" json:"group"
	Group string `protobuf:"bytes,7,opt,name=group,proto3" json:"group" bson:"group"`
	// 实例标签, 可以根据标签快速过滤实例
	// @gotags: bson:"tags" json:"tags"
	Tags map[string]string `` /* 151-byte string literal not displayed */
	// contains filtered or unexported fields
}

func NewSearchRequest

func NewSearchRequest() *SearchRequest

func (*SearchRequest) Descriptor deprecated

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

Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead.

func (*SearchRequest) GetDomain

func (x *SearchRequest) GetDomain() string

func (*SearchRequest) GetEnvironment

func (x *SearchRequest) GetEnvironment() string

func (*SearchRequest) GetGroup

func (x *SearchRequest) GetGroup() string

func (*SearchRequest) GetNamespace

func (x *SearchRequest) GetNamespace() string

func (*SearchRequest) GetPage

func (x *SearchRequest) GetPage() *request.PageRequest

func (*SearchRequest) GetRegion

func (x *SearchRequest) GetRegion() string

func (*SearchRequest) GetServiceName

func (x *SearchRequest) GetServiceName() string

func (*SearchRequest) GetTags

func (x *SearchRequest) GetTags() map[string]string

func (*SearchRequest) ProtoMessage

func (*SearchRequest) ProtoMessage()

func (*SearchRequest) ProtoReflect

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

func (*SearchRequest) Reset

func (x *SearchRequest) Reset()

func (*SearchRequest) String

func (x *SearchRequest) String() string

type ServiceClient

type ServiceClient interface {
	// 实例注册
	RegistryInstance(ctx context.Context, in *RegistryRequest, opts ...grpc.CallOption) (*Instance, error)
	// 实例上报心跳
	Heartbeat(ctx context.Context, opts ...grpc.CallOption) (Service_HeartbeatClient, error)
	// 实例注销
	UnRegistry(ctx context.Context, in *UnregistryRequest, opts ...grpc.CallOption) (*Instance, error)
	// 实例搜索, 用于客户端做服务发现
	Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*InstanceSet, error)
	// 查询实例详情
	DescribeInstance(ctx context.Context, in *DescribeInstanceRequest, opts ...grpc.CallOption) (*Instance, error)
}

ServiceClient is the client API for Service 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 NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer interface {
	// 实例注册
	RegistryInstance(context.Context, *RegistryRequest) (*Instance, error)
	// 实例上报心跳
	Heartbeat(Service_HeartbeatServer) error
	// 实例注销
	UnRegistry(context.Context, *UnregistryRequest) (*Instance, error)
	// 实例搜索, 用于客户端做服务发现
	Search(context.Context, *SearchRequest) (*InstanceSet, error)
	// 查询实例详情
	DescribeInstance(context.Context, *DescribeInstanceRequest) (*Instance, error)
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type Service_HeartbeatClient

type Service_HeartbeatClient interface {
	Send(*HeartbeatRequest) error
	Recv() (*HeartbeatResponse, error)
	grpc.ClientStream
}

type Service_HeartbeatServer

type Service_HeartbeatServer interface {
	Send(*HeartbeatResponse) error
	Recv() (*HeartbeatRequest, error)
	grpc.ServerStream
}

type Status

type Status struct {

	// 上线时间
	// @gotags: bson:"online" json:"online"
	Online int64 `protobuf:"varint,1,opt,name=online,proto3" json:"online" bson:"online"`
	// 是否健康
	// @gotags: bson:"healthy" json:"healthy"
	Healthy bool `protobuf:"varint,2,opt,name=healthy,proto3" json:"healthy" bson:"healthy"`
	// contains filtered or unexported fields
}

func NewDefaultStatus

func NewDefaultStatus() *Status

func (*Status) Descriptor deprecated

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

Deprecated: Use Status.ProtoReflect.Descriptor instead.

func (*Status) GetHealthy

func (x *Status) GetHealthy() bool

func (*Status) GetOnline

func (x *Status) GetOnline() int64

func (*Status) ProtoMessage

func (*Status) ProtoMessage()

func (*Status) ProtoReflect

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

func (*Status) Reset

func (x *Status) Reset()

func (*Status) String

func (x *Status) String() string

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) DescribeInstance

func (UnimplementedServiceServer) Heartbeat

func (UnimplementedServiceServer) RegistryInstance

func (UnimplementedServiceServer) Search

func (UnimplementedServiceServer) UnRegistry

type UnregistryRequest

type UnregistryRequest struct {

	// 需要注销的实例Id
	// @gotags: json:"instance_id"
	InstanceId string `protobuf:"bytes,1,opt,name=instance_id,json=instanceId,proto3" json:"instance_id"`
	// contains filtered or unexported fields
}

func NewUnregistryRequest

func NewUnregistryRequest(instanceId string) *UnregistryRequest

func (*UnregistryRequest) Descriptor deprecated

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

Deprecated: Use UnregistryRequest.ProtoReflect.Descriptor instead.

func (*UnregistryRequest) GetInstanceId

func (x *UnregistryRequest) GetInstanceId() string

func (*UnregistryRequest) ProtoMessage

func (*UnregistryRequest) ProtoMessage()

func (*UnregistryRequest) ProtoReflect

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

func (*UnregistryRequest) Reset

func (x *UnregistryRequest) Reset()

func (*UnregistryRequest) String

func (x *UnregistryRequest) String() string

type UnsafeServiceServer

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

UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServiceServer 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