优化服务器之间的底层连接方式

This commit is contained in:
flswld
2023-01-08 22:11:14 +08:00
parent 99408a745f
commit 6779ed8f20
21 changed files with 742 additions and 216 deletions

View File

@@ -33,6 +33,8 @@ type DiscoveryNATSRPCServer interface {
GetRegionEc2B(ctx context.Context, req *NullMsg) (*RegionEc2B, error)
// 获取负载最小的网关服务器的地址和端口
GetGateServerAddr(ctx context.Context, req *GetGateServerAddrReq) (*GateServerAddr, error)
// 获取全部网关服务器信息列表
GetAllGateServerInfoList(ctx context.Context, req *NullMsg) (*GateServerInfoList, error)
}
// RegisterDiscoveryNATSRPCServer register Discovery service
@@ -54,6 +56,8 @@ type DiscoveryNATSRPCClient interface {
GetRegionEc2B(ctx context.Context, req *NullMsg, opt ...natsrpc.CallOption) (*RegionEc2B, error)
// 获取负载最小的网关服务器的地址和端口
GetGateServerAddr(ctx context.Context, req *GetGateServerAddrReq, opt ...natsrpc.CallOption) (*GateServerAddr, error)
// 获取全部网关服务器信息列表
GetAllGateServerInfoList(ctx context.Context, req *NullMsg, opt ...natsrpc.CallOption) (*GateServerInfoList, error)
}
type _DiscoveryNATSRPCClient struct {
@@ -101,3 +105,8 @@ func (c *_DiscoveryNATSRPCClient) GetGateServerAddr(ctx context.Context, req *Ge
err := c.c.Request(ctx, "GetGateServerAddr", req, rep, opt...)
return rep, err
}
func (c *_DiscoveryNATSRPCClient) GetAllGateServerInfoList(ctx context.Context, req *NullMsg, opt ...natsrpc.CallOption) (*GateServerInfoList, error) {
rep := &GateServerInfoList{}
err := c.c.Request(ctx, "GetAllGateServerInfoList", req, rep, opt...)
return rep, err
}