dserv

package
v0.1.72 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: LGPL-2.1 Imports: 21 Imported by: 0

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 // 服务元数据,以键值对的形式保存附加信息
	Domain            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.IFutures
	// MakeBroadcastAddr 创建服务广播地址
	MakeBroadcastAddr(service string) string
	// MakeBalanceAddr 创建服务负载均衡地址
	MakeBalanceAddr(service string) string
	// MakeNodeAddr 创建服务节点地址
	MakeNodeAddr(nodeId uid.Id) (string, error)
	// SendMsg 发送消息
	SendMsg(dst string, msg gap.Msg) error
	// ForwardMsg 转发消息
	ForwardMsg(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{}
}

IWatcher 监听器

type NodeDetails added in v0.1.36

type NodeDetails struct {
	netpath.NodeDetails
	GlobalBroadcastAddr string // 全局广播地址
	GlobalBalanceAddr   string // 全局负载均衡地址
	BroadcastAddr       string // 服务广播地址
	BalanceAddr         string // 服务负载均衡地址
	LocalAddr           string // 本服务节点地址
}

NodeDetails 节点地址信息

type RecvMsgHandler

type RecvMsgHandler = generic.DelegateFunc2[string, gap.MsgPacket, error] // 接收消息的处理器

Jump to

Keyboard shortcuts

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