model

package
v0.0.0-...-7d768d8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MetaWeight meta weight
	MetaWeight = "weight"
	// MetaOffline meta offline
	MetaOffline = "offline"
	// MetaAddrs meta public ip addrs
	MetaAddrs = "addrs"
	// MetaIPCount meta ip count
	MetaIPCount = "ip_count"
	// MetaConnCount meta conn count
	MetaConnCount = "conn_count"

	// PlatformWeb platform web
	PlatformWeb = "web"
)

Variables

This section is empty.

Functions

func DecodeRoomKey

func DecodeRoomKey(key string) (string, string, error)

DecodeRoomKey decode room key.

func EncodeRoomKey

func EncodeRoomKey(typ string, room string) string

EncodeRoomKey encode a room key.

Types

type Dao

type Dao interface {
	PushMsg(c context.Context, op int32, server string, keys []string, msg []byte) (err error)
	BroadcastRoomMsg(c context.Context, op int32, room string, msg []byte) (err error)
	AddMapping(c context.Context, mid int64, key, server string) (err error)
	ExpireMapping(c context.Context, mid int64, key string) (has bool, err error)
	DelMapping(c context.Context, mid int64, key, server string) (has bool, err error)
	ServersByKeys(c context.Context, keys []string) (res []string, err error)
	KeysByMids(c context.Context, mids []int64) (ress map[string]string, olMids []int64, err error)
	AddServerOnline(c context.Context, server string, online *Online) (err error)
	ServerOnline(c context.Context, server string) (online *Online, err error)
	DelServerOnline(c context.Context, server string) (err error)
	Close() error
}

type LogicProcess

type LogicProcess interface {
	Connect(c context.Context, server, cookie string, token []byte) (mid int64, key, roomID string, accepts []int32, hb int64, err error)
	Disconnect(c context.Context, mid int64, key, server string) (has bool, err error)
	Heartbeat(c context.Context, mid int64, key, server string) (err error)
	RenewOnline(c context.Context, server string, roomCount map[string]int32) (map[string]int32, error)
	Receive(c context.Context, mid int64, proto *grpc.Proto) (err error)
	PushKeys(c context.Context, op int32, keys []string, msg []byte) (err error)
	PushMids(c context.Context, op int32, mids []int64, msg []byte) (err error)
	PushRoom(c context.Context, op int32, typ, room string, msg []byte) (err error)
	PushAll(c context.Context, op, speed int32, msg []byte) (err error)
	NodesInstances(c context.Context) (res []*naming.Instance)
	NodesWeighted(c context.Context, platform, clientIP string) *pb.NodesReply
	Ping(c context.Context) (err error)
	Close()
	OnlineTop(c context.Context, typ string, n int) (tops []*Top, err error)
	OnlineRoom(c context.Context, typ string, rooms []string) (res map[string]int32, err error)
	OnlineTotal(c context.Context) (int64, int64)
}

Action interface for logic

type Online

type Online struct {
	Server    string           `json:"server"`
	RoomCount map[string]int32 `json:"room_count"`
	Updated   int64            `json:"updated"`
}

Online ip and room online.

type Top

type Top struct {
	RoomID string `json:"room_id"`
	Count  int32  `json:"count"`
}

Top top sorted.

Jump to

Keyboard shortcuts

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