registry

package
v0.0.0-...-4cd9d19 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deregister

func Deregister() (err error)

注销

func OnInit

func OnInit(s base.IClusterService, opt ...Option) (err error)

func RegisterRpcFunc

func RegisterRpcFunc(rId core.Rpc_Key, sId string) (err error)

注册Rpc订阅

func Registry

func Registry() (err error)

警告 禁止反复调用

func UnRegisterRpcFunc

func UnRegisterRpcFunc(rId core.Rpc_Key, sId string) (err error)

Types

type Consulregistry

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

func (*Consulregistry) DeregisterSNode

func (this *Consulregistry) DeregisterSNode(sId string) (err error)

注销服务节点

func (*Consulregistry) GetRpcSubById

func (this *Consulregistry) GetRpcSubById(rId core.Rpc_Key) (rf *RpcFuncInfo, err error)

func (*Consulregistry) GetServiceByCategory

func (this *Consulregistry) GetServiceByCategory(category core.S_Category) (n []*ServiceNode, err error)

func (*Consulregistry) GetServiceById

func (this *Consulregistry) GetServiceById(sId string) (n *ServiceNode, err error)

func (*Consulregistry) GetServiceByType

func (this *Consulregistry) GetServiceByType(sType string) (n []*ServiceNode, err error)

func (*Consulregistry) Options

func (this *Consulregistry) Options() Options

func (*Consulregistry) RegisterRpcSub

func (this *Consulregistry) RegisterRpcSub(rId core.Rpc_Key, sId string) (err error)

注册rpc订阅信息

func (*Consulregistry) RegisterSNode

func (this *Consulregistry) RegisterSNode(s *ServiceNode) (err error)

注册服务节点

func (*Consulregistry) RpcHandler

func (this *Consulregistry) RpcHandler(idx uint64, data interface{})

监控服务列表变化

func (*Consulregistry) SHandler

func (this *Consulregistry) SHandler(idx uint64, data interface{})

监控服务列表变化

func (*Consulregistry) SNodeHandler

func (this *Consulregistry) SNodeHandler(idx uint64, data interface{})

监控服务列表变化

func (*Consulregistry) UnRegisterRpcSub

func (this *Consulregistry) UnRegisterRpcSub(rId core.Rpc_Key, sId string) (err error)

type FindServiceHandle

type FindServiceHandle func(snode ServiceNode)

type IRegistry

type IRegistry interface {
	Options() Options
	GetServiceById(sId string) (n *ServiceNode, err error)
	GetServiceByType(sType string) (n []*ServiceNode, err error)
	GetServiceByCategory(category core.S_Category) (n []*ServiceNode, err error)
	RegisterSNode(s *ServiceNode) (err error)
	DeregisterSNode(sId string) (err error)
	RegisterRpcSub(rId core.Rpc_Key, sId string) (err error)
	UnRegisterRpcSub(rId core.Rpc_Key, sId string) (err error)
	GetRpcSubById(rId core.Rpc_Key) (rf *RpcFuncInfo, err error)
}

type LoseServiceHandle

type LoseServiceHandle func(sId string)

type Option

type Option func(*Options)

func Address

func Address(v string) Option

func FindHandle

func FindHandle(v FindServiceHandle) Option

func LoseHandle

func LoseHandle(v LoseServiceHandle) Option

func RegisterInterval

func RegisterInterval(v time.Duration) Option

func RegisterTTL

func RegisterTTL(v time.Duration) Option

func SetTag

func SetTag(v string) Option

func UpDataHandle

func UpDataHandle(v UpDataServiceHandle) Option

type Options

type Options struct {
	Address          string
	Timeout          time.Duration
	RegisterInterval time.Duration
	RegisterTTL      time.Duration
	Find             FindServiceHandle
	UpData           UpDataServiceHandle
	Lose             LoseServiceHandle
	Tag              string //集群标签
}

type RpcFuncInfo

type RpcFuncInfo struct {
	Id            string                    //Rpc 方法Id
	SubServiceIds map[string]*ServiceRpcSub //订阅数据
}

func GetRpcFunc

func GetRpcFunc(rId core.Rpc_Key) (data *RpcFuncInfo, err error)

type ServiceNode

type ServiceNode struct {
	Tag       string          `json:"Tag"`
	Type      string          `json:"Type"`
	Category  core.S_Category `json:"Category"`
	Id        string          `json:"Id"`
	Version   int32           `json:"Version"`
	RpcId     string          `json:"RpcId"`
	PreWeight int32           `json:"PreWeight"`
}

func GetServiceByCategory

func GetServiceByCategory(category core.S_Category) (nodes []*ServiceNode, err error)

func GetServiceById

func GetServiceById(sId string) (node *ServiceNode, err error)

func GetServiceByType

func GetServiceByType(sId string) (nodes []*ServiceNode, err error)

type ServiceRpcSub

type ServiceRpcSub struct {
	Id     string
	SubNum int32
}

type UpDataServiceHandle

type UpDataServiceHandle func(snode ServiceNode)

Jump to

Keyboard shortcuts

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