dao

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: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Channel   string
	ChannelID string
	Group     string
	NatsAddr  string
	LiftAddr  string
}

LogicConfig configuration for nats / liftbridge queue

type Dao

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

NatsDao dao for nats

func New

func New(c *conf.LogicConfig) *Dao

New new a dao and return.

func (*Dao) BroadcastMsg

func (d *Dao) BroadcastMsg(c context.Context, op, speed int32, msg []byte) (err error)

BroadcastMsg push a message to databus.

func (*Dao) BroadcastRoomMsg

func (d *Dao) BroadcastRoomMsg(c context.Context, op int32, room string, msg []byte) (err error)

BroadcastRoomMsg push a message to databus.

func (*Dao) Close

func (d *Dao) Close() error

Close close the resource.

func (*Dao) Ping

func (d *Dao) Ping(c context.Context) error

Ping dao ping.

func (*Dao) PushMsg

func (d *Dao) PushMsg(c context.Context, op int32, server string, keys []string, msg []byte) (err error)

PushMsg push a message to databus.

type NatsConfig

type NatsConfig = Config

type NatsDao

type NatsDao = Dao

func (*NatsDao) AddMapping

func (d *NatsDao) AddMapping(c context.Context, mid int64, key, server string) (err error)

AddMapping add a mapping. Mapping:

mid -> key_server
key -> server

func (*NatsDao) AddServerOnline

func (d *NatsDao) AddServerOnline(c context.Context, server string, online *model.Online) (err error)

AddServerOnline add a server online.

func (*NatsDao) DelMapping

func (d *NatsDao) DelMapping(c context.Context, mid int64, key, server string) (has bool, err error)

DelMapping del a mapping.

func (*NatsDao) DelServerOnline

func (d *NatsDao) DelServerOnline(c context.Context, server string) (err error)

DelServerOnline del a server online.

func (*NatsDao) ExpireMapping

func (d *NatsDao) ExpireMapping(c context.Context, mid int64, key string) (has bool, err error)

ExpireMapping expire a mapping.

func (*NatsDao) KeysByMids

func (d *NatsDao) KeysByMids(c context.Context, mids []int64) (ress map[string]string, olMids []int64, err error)

KeysByMids get a key server by mid.

func (*NatsDao) ServerOnline

func (d *NatsDao) ServerOnline(c context.Context, server string) (online *model.Online, err error)

ServerOnline get a server online.

func (*NatsDao) ServersByKeys

func (d *NatsDao) ServersByKeys(c context.Context, keys []string) (res []string, err error)

ServersByKeys get a server by key.

Jump to

Keyboard shortcuts

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