gateway

package
v0.0.0-...-d436db8 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GorpcClient *gorpc.Client

Functions

func CheckTags

func CheckTags(addr string, connId logic.ConnectionId, tags []string) (map[string]bool, error)

func ConnLen

func ConnLen(addr string) (int, error)

func DelTag

func DelTag(addr string, tag string) error

func DoOperations

func DoOperations(gatewayAddr string, tags []string, prefixTag string, connIds []logic.ConnectionId, gwr *router.GwResp) error

发送一些行为(gwr)到gateway,对应的connIds(如果有)或者tags(如果有)的连接将执行这些操作

func DoOperationsBatch

func DoOperationsBatch(gatewayAddr string, req []*Operations) error

func GetConnectionInfo

func GetConnectionInfo(addr string, connId logic.ConnectionId) (map[string]string, error)

func GetConnectionTags

func GetConnectionTags(addr string, connId logic.ConnectionId) ([]string, error)

func GetLastSecondFlow

func GetLastSecondFlow(addr string) (uint64, error)

func TagStat

func TagStat(addr string) (map[string]int, error)

func TagStatAll

func TagStatAll(addr string) (map[string]int, error)

Types

type ConnTags

type ConnTags struct {
	ConnId logic.ConnectionId
	Tags   []string
}

type GatewayStat

type GatewayStat struct {
	Reads                 uint64
	Writes                uint64
	OpenConns             uint64
	OpenConnFails         uint64
	CloseConns            uint64
	CloseConnFails        uint64
	OpenConnResponseTime  uint64
	CloseConnResponseTime uint64
	StatResponse          int32
	LastSecondFlow        uint64
	ThisSecondFlow        uint64
}

func GetGatewayQps

func GetGatewayQps(gatewayGorpcAddr string) (*GatewayStat, error)

* get gateway qps from specified saver * @param gatewayGorpcAddr is specified saver go rpc address * @return (*GatewayStat, nil) if successful, otherwise (*GatewayStat{}, error) will be return

func GetGatewayTotalOps

func GetGatewayTotalOps(gatewayGorpcAddr string) (*GatewayStat, error)

* get gateway total operations count after start from specified saver * @param gatewayGorpcAddr is specified saver go rpc address * @return (*GatewayStat, nil) if successful, otherwise (*GatewayStat{}, error) will be return

func (*GatewayStat) Add

func (stat *GatewayStat) Add(add *GatewayStat) *GatewayStat

* stat add add and then store result in stat * @param add is value will be added * @return stat with new value

func (*GatewayStat) AtomicAddCloseConnFails

func (stat *GatewayStat) AtomicAddCloseConnFails(i uint64) uint64

func (*GatewayStat) AtomicAddCloseConnResponseTime

func (stat *GatewayStat) AtomicAddCloseConnResponseTime(i uint64) uint64

func (*GatewayStat) AtomicAddCloseConns

func (stat *GatewayStat) AtomicAddCloseConns(i uint64) uint64

func (*GatewayStat) AtomicAddOpenConnFails

func (stat *GatewayStat) AtomicAddOpenConnFails(i uint64) uint64

func (*GatewayStat) AtomicAddOpenConnResponseTime

func (stat *GatewayStat) AtomicAddOpenConnResponseTime(i uint64) uint64

func (*GatewayStat) AtomicAddOpenConns

func (stat *GatewayStat) AtomicAddOpenConns(i uint64) uint64

func (*GatewayStat) AtomicAddReads

func (stat *GatewayStat) AtomicAddReads(reads uint64) uint64

atomic add functions

func (*GatewayStat) AtomicAddThisSecondFlow

func (stat *GatewayStat) AtomicAddThisSecondFlow(i uint64) uint64

func (*GatewayStat) AtomicAddWrites

func (stat *GatewayStat) AtomicAddWrites(writes uint64) uint64

func (*GatewayStat) AtomicCopyTo

func (stat *GatewayStat) AtomicCopyTo(copy *GatewayStat) *GatewayStat

operations

  • this copy content of stat to 'copy' atomicly
  • @param copy is target the content copy to
  • @return copy if it is not nil, otherwise will return a new GatewayStat point

func (*GatewayStat) AtomicGetCloseConnFails

func (stat *GatewayStat) AtomicGetCloseConnFails() uint64

func (*GatewayStat) AtomicGetCloseConnResponseTime

func (stat *GatewayStat) AtomicGetCloseConnResponseTime() uint64

func (*GatewayStat) AtomicGetCloseConns

func (stat *GatewayStat) AtomicGetCloseConns() uint64

func (*GatewayStat) AtomicGetLastSecondFlow

func (stat *GatewayStat) AtomicGetLastSecondFlow() uint64

func (*GatewayStat) AtomicGetOpenConnFails

func (stat *GatewayStat) AtomicGetOpenConnFails() uint64

func (*GatewayStat) AtomicGetOpenConnResponseTime

func (stat *GatewayStat) AtomicGetOpenConnResponseTime() uint64

func (*GatewayStat) AtomicGetOpenConns

func (stat *GatewayStat) AtomicGetOpenConns() uint64

func (*GatewayStat) AtomicGetReads

func (stat *GatewayStat) AtomicGetReads() uint64

func (*GatewayStat) AtomicGetStatResponse

func (stat *GatewayStat) AtomicGetStatResponse() bool

func (*GatewayStat) AtomicGetThisSecondFlow

func (stat *GatewayStat) AtomicGetThisSecondFlow() uint64

func (*GatewayStat) AtomicGetTotalRequests

func (stat *GatewayStat) AtomicGetTotalRequests() uint64

func (*GatewayStat) AtomicGetWrites

func (stat *GatewayStat) AtomicGetWrites() uint64

func (*GatewayStat) AtomicMakeQps

func (stat *GatewayStat) AtomicMakeQps(i uint64) string

* this computes qps with stat according to interval * @param i is interval which unit is second * @return a json string that include saver QPS information

func (*GatewayStat) AtomicSetLastSecondFlow

func (stat *GatewayStat) AtomicSetLastSecondFlow(flow uint64)

func (*GatewayStat) AtomicSetReadWrites

func (stat *GatewayStat) AtomicSetReadWrites(reads, writes uint64)

func (*GatewayStat) AtomicSetStatResponse

func (stat *GatewayStat) AtomicSetStatResponse(value bool)

func (*GatewayStat) AtomicSetThisSecondFlow

func (stat *GatewayStat) AtomicSetThisSecondFlow(flow uint64)

func (*GatewayStat) QpsString

func (stat *GatewayStat) QpsString() string

func (*GatewayStat) String

func (stat *GatewayStat) String() string

func (*GatewayStat) Sub

func (stat *GatewayStat) Sub(sub *GatewayStat) *GatewayStat

* stat subtract sub and then store result in stat * @param sub is value will be subtracted * @return stat with new value

type Operations

type Operations struct {
	ConnectionIds []logic.ConnectionId // 要发送的连接id
	Gwr           *router.GwResp
	Tags          []string // 要发送的tag
	PrefixTag     string   // 发指定前缀的tag
}

Jump to

Keyboard shortcuts

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