Documentation ¶
Index ¶
- Constants
- type CallFunc
- type Cluster
- func (c *Cluster) AddCluster(info *rpc.ClusterInfo)
- func (c *Cluster) BindPacketFunc(callfunc network.PacketFunc)
- func (c *Cluster) Call(parmas ...interface{})
- func (c *Cluster) CallMsg(cb interface{}, head rpc.RpcHead, funcName string, params ...interface{}) error
- func (c *Cluster) Cluster_Add(ctx context.Context, info *rpc.ClusterInfo)
- func (c *Cluster) Cluster_Del(ctx context.Context, info *rpc.ClusterInfo)
- func (c *Cluster) DelCluster(info *rpc.ClusterInfo)
- func (c *Cluster) GetCluster(head rpc.RpcHead) *rpc.ClusterInfo
- func (c *Cluster) HandlePacket(packet rpc.Packet)
- func (c *Cluster) InitCluster(info *rpc.ClusterInfo, Endpoints []string, natsUrl string, params ...OpOption)
- func (c *Cluster) IsEnoughStub(stub rpc.STUB) bool
- func (c *Cluster) RandomCluster(head rpc.RpcHead) rpc.RpcHead
- func (c *Cluster) Send(head rpc.RpcHead, packet rpc.Packet)
- func (c *Cluster) SendMsg(head rpc.RpcHead, funcName string, params ...interface{})
- type EmptyClusterInfo
- type HashClusterMap
- type HashClusterSocketMap
- type ICluster
- type Master
- type Op
- type OpOption
- type Service
- type Snowflake
- type Stub
Constants ¶
View Source
const ( MAX_CLUSTER_NUM = int(rpc.SERVICE_DB) + 1 CALL_TIME_OUT = 500 * time.Millisecond )
View Source
const ( ETCD_DIR = "server/" MAILBOX_TL_TIME = etv3.MAILBOX_TL_TIME )
View Source
const STUB_TTL_TIME = 30 * time.Second
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct { actor.Actor *Service //集群注册 MailBox etv3.MailBox StubMailBox etv3.StubMailBox Stub conf.Stub // contains filtered or unexported fields }
集群服务器
var (
MGR Cluster
)
func (*Cluster) AddCluster ¶
func (c *Cluster) AddCluster(info *rpc.ClusterInfo)
func (*Cluster) BindPacketFunc ¶
func (c *Cluster) BindPacketFunc(callfunc network.PacketFunc)
func (*Cluster) Call ¶
func (c *Cluster) Call(parmas ...interface{})
params[0]:rpc.RpcHead params[1]:error
func (*Cluster) Cluster_Add ¶
func (c *Cluster) Cluster_Add(ctx context.Context, info *rpc.ClusterInfo)
集群新加member
func (*Cluster) Cluster_Del ¶
func (c *Cluster) Cluster_Del(ctx context.Context, info *rpc.ClusterInfo)
集群删除member
func (*Cluster) DelCluster ¶
func (c *Cluster) DelCluster(info *rpc.ClusterInfo)
func (*Cluster) GetCluster ¶
func (c *Cluster) GetCluster(head rpc.RpcHead) *rpc.ClusterInfo
func (*Cluster) HandlePacket ¶
func (*Cluster) InitCluster ¶
type EmptyClusterInfo ¶
type EmptyClusterInfo struct {
rpc.ClusterInfo
}
func (*EmptyClusterInfo) String ¶
func (c *EmptyClusterInfo) String() string
type HashClusterMap ¶
type HashClusterMap map[uint32]*rpc.ClusterInfo
type HashClusterSocketMap ¶
type HashClusterSocketMap map[uint32]*rpc.ClusterInfo
type ICluster ¶
type ICluster interface { actor.IActor InitCluster(info *rpc.ClusterInfo, Endpoints []string, natsUrl string, params ...OpOption) RegisterClusterCall() //注册集群通用回调 AddCluster(info *rpc.ClusterInfo) DelCluster(info *rpc.ClusterInfo) GetCluster(rpc.RpcHead) *rpc.ClusterInfo BindPacketFunc(packetFunc network.PacketFunc) CallMsg(interface{}, rpc.RpcHead, string, ...interface{}) error //同步给集群特定服务器 RandomCluster(head rpc.RpcHead) rpc.RpcHead //随机分配 IsEnoughStub(stub rpc.STUB) bool }
Click to show internal directories.
Click to hide internal directories.