cluster

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 16 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MAX_CLUSTER_NUM = int(rpc.SERVICE_NUM)
	CALL_TIME_OUT   = 500 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CallFunc

type CallFunc struct {
	Func       interface{}
	FuncType   reflect.Type
	FuncVal    reflect.Value
	FuncParams string
}

type Cluster

type Cluster struct {
	actor.Actor
	*Service

	MailBox     etcd.MailBox
	StubMailBox etcd.StubMailBox
	Stub        common.Stub
	// contains filtered or unexported fields
}
var (
	MGR Cluster
)

func (*Cluster) AddCluster

func (c *Cluster) AddCluster(info *common.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) CallMsg

func (c *Cluster) CallMsg(cb interface{}, head rpc.RpcHead, funcName string, params ...interface{}) error

func (*Cluster) Cluster_Add

func (c *Cluster) Cluster_Add(ctx context.Context, info *common.ClusterInfo)

集群新加member

func (*Cluster) Cluster_Del

func (c *Cluster) Cluster_Del(ctx context.Context, info *common.ClusterInfo)

集群删除member

func (*Cluster) DelCluster

func (c *Cluster) DelCluster(info *common.ClusterInfo)

func (*Cluster) GetCluster

func (c *Cluster) GetCluster(head rpc.RpcHead) *common.ClusterInfo

func (*Cluster) HandlePacket

func (c *Cluster) HandlePacket(packet rpc.Packet)

func (*Cluster) InitCluster

func (c *Cluster) InitCluster(info *common.ClusterInfo, endpoints []string, natsUrl string, params ...OpOption)

func (*Cluster) IsEnoughStub

func (c *Cluster) IsEnoughStub(stub rpc.STUB) bool

func (*Cluster) RandomCluster

func (c *Cluster) RandomCluster(head rpc.RpcHead) rpc.RpcHead

func (*Cluster) RegisterClusterCall added in v0.0.3

func (c *Cluster) RegisterClusterCall()

func (*Cluster) Send

func (c *Cluster) Send(head rpc.RpcHead, packet rpc.Packet)

func (*Cluster) SendMsg

func (c *Cluster) SendMsg(head rpc.RpcHead, funcName string, params ...interface{})

type ClusterMap

type ClusterMap map[uint32]*common.ClusterInfo

type ClusterSocketMap

type ClusterSocketMap map[uint32]*common.ClusterInfo

type EmptyClusterInfo

type EmptyClusterInfo struct {
	common.ClusterInfo
}

func (*EmptyClusterInfo) String

func (c *EmptyClusterInfo) String() string

type ICluster

type ICluster interface {
	actor.IActor
	InitCluster(info *common.ClusterInfo, endpoints []string, natsUrl string, params ...OpOption)
	RegisterClusterCall() //注册集群通用回调
	AddCluster(info *common.ClusterInfo)
	DelCluster(info *common.ClusterInfo)
	GetCluster(rpc.RpcHead) *common.ClusterInfo
	BindPacketFunc(packetFunc network.PacketFunc)
	CallMsg(interface{}, rpc.RpcHead, string, ...interface{}) error //同步给集群特定服务器
	RandomCluster(head rpc.RpcHead) rpc.RpcHead                     //随机分配
	IsEnoughStub(stub rpc.STUB) bool
}

type Master

type Master etcd.Master

func NewMaster

func NewMaster(info common.IClusterInfo, endpoints []string) *Master

type Op

type Op struct {
	// contains filtered or unexported fields
}

type OpOption

type OpOption func(*Op)

func WithMailBoxEtcd

func WithMailBoxEtcd(Endpoints []string) OpOption

func WithStubMailBoxEtcd

func WithStubMailBoxEtcd(Endpoints []string, stub *common.Stub) OpOption

type Service

type Service etcd.Service

func NewService

func NewService(info *common.ClusterInfo, endpoints []string) *Service

type Snowflake

type Snowflake etcd.Snowflake

func NewSnowflake

func NewSnowflake(endpoints []string) *Snowflake

type Stub

type Stub struct {
	StubMailBox common.StubMailBox
	// contains filtered or unexported fields
}

func (*Stub) InitStub

func (s *Stub) InitStub(stub rpc.STUB)

func (*Stub) IsRegister

func (s *Stub) IsRegister() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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