Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultPort = 8910
View Source
const ESConfigFileName = "es.json"
View Source
const ESConfigPath = "esconfig"
View Source
const ESKeyFileExt = ".eskey"
View Source
const ESVersion = 1
View Source
const ETCDBasePath = "/es_rpc"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ESConfig ¶
type ESConfig struct {
Port int `json:"port"` //服务端口,默认端口8910
Name string `json:"name"` //系统中的nodename用于区分不同服务
Key string `json:"key"` //链接密钥,用于链接到整个系统中
Etcd string `json:"etcd"` //发现服务地址
Endpoint string `json:"endpoint"` //访问端点,如果配置,服务启动时会使用访问端点向etcd进行注册,其他服务会通过此访问端点来访问此服务
}
ESConfig 配置文件映射结构
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 NodeInfo ¶
type NodeInfo struct {
NodeName string //节点名
UUID string //节点的唯一标识
LastActive int64 //节点最后活跃时间,毫秒时间戳
IP string //节点ip
Port int //服务端口
ESVersion int //服务使用的es版本
}
NodeInfo 节点信息
type Request ¶
type Request struct {
NodeName string // 节点名称
Path string //服务包路径
Method string //服务名
Parameters [][]byte //调用参数
}
Request 调用服务的时候发出去的数据
func (*Request) AddParameter ¶
func (*Request) SetParameters ¶
type Result ¶
type Result struct {
Binary [][]byte // 方法返回的数据
}
Result 服务执行结果
type ServiceInfo ¶
type ServiceInfo struct {
Path string //服务对象(结构)路径
Methods map[string]*MethodInfo // 服务提供的方法
}
ServiceInfo 服务信息
Click to show internal directories.
Click to hide internal directories.