Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Name = self.Name Using = self.Using Install = self.Install Uninstall = self.Uninstall )
View Source
var With _Option
Functions ¶
This section is empty.
Types ¶
type DistServiceOptions ¶
type DistServiceOptions struct {
Version string // 服务版本号
Meta map[string]string // 服务元数据,以键值对的形式保存附加信息
DomainRoot string // 服务地址根域
TTL time.Duration // 服务信息TTL
RefreshTTL bool // 主动刷新服务信息TTL
FutureTimeout time.Duration // 异步模型Future超时时间
DecoderMsgCreator gap.IMsgCreator // 消息包解码器的消息构建器
RecvMsgHandler RecvMsgHandler // 接收消息的处理器(优先级低于监控器)
}
DistServiceOptions 所有选项
type IDistService ¶
type IDistService interface {
// GetNodeDetails 获取节点地址信息
GetNodeDetails() *NodeDetails
// GetFutures 获取异步模型Future控制器
GetFutures() *concurrent.Futures
// SendMsg 发送消息
SendMsg(dst string, msg gap.Msg) error
// ForwardMsg 转发消息
ForwardMsg(svc, src, dst string, seq int64, msg gap.Msg) error
// WatchMsg 监听消息(优先级高)
WatchMsg(ctx context.Context, handler RecvMsgHandler) IWatcher
}
IDistService 分布式服务支持
type IWatcher ¶
type IWatcher interface {
context.Context
Terminate() <-chan struct{}
Terminated() <-chan struct{}
}
IWatcher 监听器
type NodeDetails ¶
type NodeDetails struct {
netpath.NodeDetails
GlobalBroadcastAddr string // 全局广播地址
GlobalBalanceAddr string // 全局负载均衡地址
BroadcastAddr string // 服务广播地址
BalanceAddr string // 服务负载均衡地址
LocalAddr string // 本服务节点地址
}
NodeDetails 服务节点地址信息
func (*NodeDetails) MakeBalanceAddr ¶
func (d *NodeDetails) MakeBalanceAddr(service string) string
MakeBalanceAddr 创建服务负载均衡地址
func (*NodeDetails) MakeBroadcastAddr ¶
func (d *NodeDetails) MakeBroadcastAddr(service string) string
MakeBroadcastAddr 创建服务广播地址
func (*NodeDetails) MakeNodeAddr ¶
func (d *NodeDetails) MakeNodeAddr(nodeId uid.Id) (string, error)
MakeNodeAddr 创建服务节点地址
type RecvMsgHandler ¶
Click to show internal directories.
Click to hide internal directories.