logic

package
v0.0.0-...-8062269 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoadBalancer

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

LoadBalancer load balancer.

func NewLoadBalancer

func NewLoadBalancer() *LoadBalancer

NewLoadBalancer new a load balancer.

func (*LoadBalancer) NodeAddrs

func (lb *LoadBalancer) NodeAddrs(region, domain string, regionWeight float64) (domains, addrs []string)

NodeAddrs return node addrs.

func (*LoadBalancer) Size

func (lb *LoadBalancer) Size() int

Size return node size.

func (*LoadBalancer) Update

func (lb *LoadBalancer) Update(ins []*naming.Instance)

Update update server nodes.

type Logic

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

Logic struct

func New

func New(c *conf.Config) (l *Logic)

New init

func (*Logic) Close

func (l *Logic) Close()

Close close resources.

func (*Logic) Connect

func (l *Logic) Connect(c context.Context, server, cookie string, token []byte) (mid int64, key, roomID string, accepts []int32, hb int64, err error)

Connect connected a conn.

func (*Logic) Disconnect

func (l *Logic) Disconnect(c context.Context, mid int64, key, server string) (has bool, err error)

Disconnect disconnect a conn.

func (*Logic) Heartbeat

func (l *Logic) Heartbeat(c context.Context, mid int64, key, server string) (err error)

Heartbeat heartbeat a conn.

func (*Logic) NodesInstances

func (l *Logic) NodesInstances(c context.Context) (res []*naming.Instance)

NodesInstances get servers info.

func (*Logic) NodesWeighted

func (l *Logic) NodesWeighted(c context.Context, platform, clientIP string) *pb.NodesReply

NodesWeighted get node list.

func (*Logic) OnlineRoom

func (l *Logic) OnlineRoom(c context.Context, typ string, rooms []string) (res map[string]int32, err error)

OnlineRoom get rooms online.

func (*Logic) OnlineTop

func (l *Logic) OnlineTop(c context.Context, typ string, n int) (tops []*model.Top, err error)

OnlineTop get the top online.

func (*Logic) OnlineTotal

func (l *Logic) OnlineTotal(c context.Context) (int64, int64)

OnlineTotal get all online.

func (*Logic) Ping

func (l *Logic) Ping(c context.Context) (err error)

Ping ping resources is ok.

func (*Logic) PushAll

func (l *Logic) PushAll(c context.Context, op, speed int32, msg []byte) (err error)

PushAll push a message to all.

func (*Logic) PushKeys

func (l *Logic) PushKeys(c context.Context, op int32, keys []string, msg []byte) (err error)

PushKeys push a message by keys.

func (*Logic) PushMids

func (l *Logic) PushMids(c context.Context, op int32, mids []int64, msg []byte) (err error)

PushMids push a message by mid.

func (*Logic) PushRoom

func (l *Logic) PushRoom(c context.Context, op int32, typ, room string, msg []byte) (err error)

PushRoom push a message by room.

func (*Logic) Receive

func (l *Logic) Receive(c context.Context, mid int64, proto *protocol.Proto) (err error)

Receive receive a message.

func (*Logic) RenewOnline

func (l *Logic) RenewOnline(c context.Context, server string, roomCount map[string]int32) (map[string]int32, error)

RenewOnline renew a server online.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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