service

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 30 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) NodeAddrsByGeo

func (lb *LoadBalancer) NodeAddrsByGeo(domain string, lat, lng float64, overseas, ipv6 bool) (domains, addrs []string)

NodeAddrsByGeo return node addrs by geo.

func (*LoadBalancer) NodeAddrsByRegion

func (lb *LoadBalancer) NodeAddrsByRegion(region, domain string, regionWeight float64, overseas, ipv6 bool) (domains, addrs []string)

NodeAddrsByRegion return node addrs.

func (*LoadBalancer) NodeDetails

func (lb *LoadBalancer) NodeDetails(region string, regionWeight float64) (res []map[string]interface{})

NodeDetails return nodes.

func (*LoadBalancer) Size

func (lb *LoadBalancer) Size() int

Size return node size.

func (*LoadBalancer) Update

func (lb *LoadBalancer) Update(srvs []*model.ServerInfo)

Update update server nodes.

type ServerBackoff

type ServerBackoff struct {
	MaxDelay  int32
	BaseDelay int32
	Factor    float32
	Jitter    float32
}

ServerBackoff server backoff config.

type ServerConfig

type ServerConfig struct {
	Domain       string
	HostDomain   string
	TCPPort      int
	WSPort       int
	WSSPort      int
	HeartbeatMax int
	Heartbeat    xtime.Duration
	RegionWeight float64
}

ServerConfig server config.

type Service

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

Service struct

func New

func New(dis *discovery.Discovery) (s *Service)

New new a service and return.

func (*Service) Close

func (s *Service) Close()

Close Service.

func (*Service) Connect

func (s *Service) Connect(c context.Context, server, serverKey, cookie string, token []byte) (mid int64, key, roomID string, paltform string, accepts []int32, err error)

Connect connect a conn.

func (*Service) Disconnect

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

Disconnect disconnect a conn.

func (*Service) Heartbeat

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

Heartbeat heartbeat a conn.

func (*Service) OnlineRoom

func (s *Service) OnlineRoom(c context.Context, business string, rooms []string) (res map[string]int32, err error)

OnlineRoom get rooms online.

func (*Service) OnlineTop

func (s *Service) OnlineTop(c context.Context, business string, n int) (tops []*model.Top, err error)

OnlineTop get the top online.

func (*Service) OnlineTotal

func (s *Service) OnlineTotal(c context.Context) (int64, int64)

OnlineTotal get all online.

func (*Service) Ping

func (s *Service) Ping(c context.Context) (err error)

Ping Service.

func (*Service) PushAll

func (s *Service) PushAll(c context.Context, op, speed int32, msg, platform string, contentType int32) (err error)

PushAll push a message to all.

func (*Service) PushKeys

func (s *Service) PushKeys(c context.Context, op int32, keys []string, msg string, contentType int32) (err error)

PushKeys push a message by keys.

func (*Service) PushMids

func (s *Service) PushMids(c context.Context, op int32, mids []int64, msg string, contentType int32) (err error)

PushMids push a message by mid.

func (*Service) PushRoom

func (s *Service) PushRoom(c context.Context, op int32, room, msg string, contentType int32) (err error)

PushRoom push a message by room.

func (*Service) Receive

func (s *Service) Receive(c context.Context, mid int64, proto *model.Proto) (err error)

Receive receive a message.

func (*Service) RenewOnline

func (s *Service) RenewOnline(c context.Context, server string, shard int32, roomCount map[string]int32) (mergedRoomCount map[string]int32, err error)

RenewOnline renew a server online.

func (*Service) ServerInfos

func (s *Service) ServerInfos(c context.Context) (res []*model.ServerInfo, err error)

ServerInfos get servers info.

func (*Service) ServerList

func (s *Service) ServerList(c context.Context, platform string) *pb.ServerListReply

ServerList get server list.

func (*Service) ServerWeight

func (s *Service) ServerWeight(c context.Context, clientIP string) (interface{}, string, string, error)

ServerWeight server node details.

Jump to

Keyboard shortcuts

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