domain

package
v0.0.0-...-d4bbc0e Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

Types

type ClientContext

type ClientContext struct {
	IP string `json:"ip"`
}

type Dispatcher

type Dispatcher struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type Endpoint

type Endpoint struct {
	IP          string  `json:"ip"`
	Port        string  `json:"port"`
	ActiveSorce float64 `json:"-"`
	StaticSorce float64 `json:"-"`
	Stats       *Stat   `json:"-"`
	// contains filtered or unexported fields
}

func Dispatch

func Dispatch(ctx *IpConfContext) []*Endpoint

func NewEndport

func NewEndport(ip, port string) *Endpoint

func (*Endpoint) CalculateScore

func (ed *Endpoint) CalculateScore(ctx *IpConfContext)

func (*Endpoint) UpdateStat

func (ed *Endpoint) UpdateStat(s *Stat)

type IpConfContext

type IpConfContext struct {
	Ctx       *context.Context
	AppCtx    *app.RequestContext
	ClientCtx *ClientContext
}

func BuildIpConfContext

func BuildIpConfContext(c *context.Context, ctx *app.RequestContext) *IpConfContext

构建ipconf的conetxt

type Stat

type Stat struct {
	MessageBytes float64 // 活跃分 gateway 每秒钟收发字节数的 剩余值
	ConnectNum   float64 // 静态分 gateway 总体持有的长连接数量的 剩余值
}

数值代表的是,此endpoint对应的机器其自身剩余的资源指标

func (*Stat) Add

func (s *Stat) Add(st *Stat)

func (*Stat) Avg

func (s *Stat) Avg(num float64)

func (*Stat) CalculateActiveSorce

func (s *Stat) CalculateActiveSorce() float64

func (*Stat) CalculateStaticSorce

func (s *Stat) CalculateStaticSorce() float64

func (*Stat) Clone

func (s *Stat) Clone() *Stat

func (*Stat) Sub

func (s *Stat) Sub(st *Stat)

Jump to

Keyboard shortcuts

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