is

package
v1.0.0-bate1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const RpcPingFuncName = "Ping"
View Source
const RpcRegNodeFuncName = "RegNode"
View Source
const RpcServiceName = "ESIndexServer"

Variables

This section is empty.

Functions

func InitESIndexServer

func InitESIndexServer() error

func RefreshServiceIndexVersion

func RefreshServiceIndexVersion()

RefreshServiceIndexVersion 刷新服务器存储的服务索引版本,在新增服务和node发生上线与离线时需要刷新

Types

type ESIndexServer

type ESIndexServer struct {
}

func (*ESIndexServer) Ping

func (is *ESIndexServer) Ping(ctx context.Context, ping *Ping, reply *Reply) error

func (*ESIndexServer) RegNode

func (is *ESIndexServer) RegNode(ctx context.Context, node *Node, reply *Reply) error

type IndexInfo

type IndexInfo struct {
	NodeName     string                  //节点名称
	Online       bool                    //服务是否在线
	ServicesCode uint32                  // 当前存储的Services的hashCode,用于判断服务是否发生变化
	Services     map[string]*ServiceInfo // 当前节点包含的服务
	Nodes        map[string]*NodeInfo    // 当前节点ming在线的实例
}

IndexInfo 服务器索引信息,需要持久化

type MethodInfo

type MethodInfo struct {
	MethodName  string   //方法名
	ParamCount  int      //方法参数个数
	ParamsType  []string //每个参数类型
	ReturnCount int      //方法返回参数和数
	ReturnsType []string // 方法返回参数的类型
}

MethodInfo 方法信息

type Node

type Node struct {
	Services map[string]*ServiceInfo
	NodeInfo *NodeInfo
}

Node 节点注册需要传入的信息

type NodeInfo

type NodeInfo struct {
	NodeName   string //节点名
	UUID       string //节点的唯一标识
	LastActive int64  //节点最后活跃时间,毫秒时间戳
	IP         string //节点ip
	Port       int    //服务端口
	ESVersion  int    //服务使用的es版本
}

NodeInfo 节点信息

type Ping

type Ping struct {
	NodeName            string
	UUID                string
	LastActive          int64
	ServiceIndexVersion int64
}

Ping 节点ping数据包

type Reply

type Reply struct {
	State               ReplyState            //状态
	ServiceIndexVersion int64                 //服务信息版本
	ServiceIndex        map[string]*IndexInfo //所有服务的索引信息
	ESVersion           int                   //当前的版本
}

type ReplyState

type ReplyState int
const (
	ReplyOK ReplyState = iota
	ReplyFail
	ReplyServiceNofound
)

type ServiceInfo

type ServiceInfo struct {
	Path    string                 //服务对象(结构)路径
	Methods map[string]*MethodInfo // 服务提供的方法
}

ServiceInfo 服务信息

Jump to

Keyboard shortcuts

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