proxy

package
v0.0.0-...-110c355 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatsCmds = StatsFlags(1 << iota)
	StatsSlots
	StatsRuntime

	StatsFull = StatsFlags(^uint32(0))
)

Variables

This section is empty.

Functions

func CheckIsBlackKey

func CheckIsBlackKey(key string) bool

func CheckIsWhiteKey

func CheckIsWhiteKey(key string) bool

func FillPconfigs

func FillPconfigs(pconfigs []*models.Pconfig) error

func FillSlots

func FillSlots(slots []*models.Slot) error

func Pconfigs

func Pconfigs() []*models.Pconfig

func SetProxyInfo

func SetProxyInfo(stats *Stats)

func ShortSlots

func ShortSlots() []*models.Slot

Types

type GlobalOpsCost

type GlobalOpsCost struct {
	AvgCost   atomic.Int64 `json:"avg_cost"`
	KVCost    atomic.Int64 `json:"kv_cost"`
	ListCost  atomic.Int64 `json:"list_cost"`
	HashCost  atomic.Int64 `json:"hash_cost"`
	SetCost   atomic.Int64 `json:"set_cost"`
	ZsetCost  atomic.Int64 `json:"zset_cost"`
	WriteCost atomic.Int64 `json:"write_cost"`
	ReadCost  atomic.Int64 `json:"read_cost"`
}

type OpsCost

type OpsCost struct {
	AvgCost   int64 `json:"avg_cost"`
	KVCost    int64 `json:"kv_cost"`
	ListCost  int64 `json:"list_cost"`
	HashCost  int64 `json:"hash_cost"`
	SetCost   int64 `json:"set_cost"`
	ZsetCost  int64 `json:"zset_cost"`
	WriteCost int64 `json:"write_cost"`
	ReadCost  int64 `json:"read_cost"`
}

type Overview

type Overview struct {
	Version string         `json:"version"`
	Compile string         `json:"compile"`
	Config  *config.Config `json:"config,omitempty"`
	Model   *models.Proxy  `json:"model,omitempty"`
	Stats   *Stats         `json:"stats,omitempty"`
	Slots   []*models.Slot `json:"slots,omitempty"`
}

func GetOverview

func GetOverview(s *Proxy, flags StatsFlags) *Overview

type Proxy

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

func New

func New(cfg *config.Config) (*Proxy, error)

func (*Proxy) AdminAddress

func (p *Proxy) AdminAddress() string

func (*Proxy) Close

func (p *Proxy) Close() error

func (*Proxy) Config

func (p *Proxy) Config() *config.Config

func (*Proxy) IsClosed

func (p *Proxy) IsClosed() bool

func (*Proxy) IsOnline

func (p *Proxy) IsOnline() bool

func (*Proxy) Model

func (p *Proxy) Model() *models.Proxy

func (*Proxy) ProxyAddress

func (p *Proxy) ProxyAddress() string

func (*Proxy) Start

func (p *Proxy) Start() error

func (*Proxy) XAuth

func (p *Proxy) XAuth() string

type RuntimeStats

type RuntimeStats struct {
	General struct {
		Alloc   uint64 `json:"alloc"`
		Sys     uint64 `json:"sys"`
		Lookups uint64 `json:"lookups"`
		Mallocs uint64 `json:"mallocs"`
		Frees   uint64 `json:"frees"`
	} `json:"general"`

	Heap struct {
		Alloc   uint64 `json:"alloc"`
		Sys     uint64 `json:"sys"`
		Idle    uint64 `json:"idle"`
		Inuse   uint64 `json:"inuse"`
		Objects uint64 `json:"objects"`
	} `json:"heap"`

	GC struct {
		Num          uint32  `json:"num"`
		CPUFraction  float64 `json:"cpu_fraction"`
		TotalPauseMs uint64  `json:"total_pausems"`
	} `json:"gc"`

	NumProcs      int   `json:"num_procs"`
	NumGoroutines int   `json:"num_goroutines"`
	NumCgoCall    int64 `json:"num_cgo_call"`
}

type Stats

type Stats struct {
	Online bool `json:"online"`
	Closed bool `json:"closed"`

	ReadCrossCloud bool `json:"read_cross_cloud"`
	PoolActive     int  `json:"pool_active"`

	CmdOps struct {
		Total       int64                 `json:"total"`
		Fails       int64                 `json:"fails"`
		PeriodFails int64                 `json:"periodfails"`
		QPS         int64                 `json:"qps"`
		Cmd         []*dostats.CalOpStats `json:"cmd,omitempty"`

		OpsCost
	} `json:"cdm_ops"`

	Pool dostats.PoolStat `json:"pool"`

	Sessions struct {
		Total int64 `json:"total"`
		Alive int64 `json:"alive"`
	} `json:"sessions"`

	Rusage struct {
		Now string       `json:"now"`
		CPU float64      `json:"cpu"`
		Mem int64        `json:"mem"`
		Raw *utils.Usage `json:"raw,omitempty"`
	} `json:"rusage"`

	Runtime *RuntimeStats `json:"runtime,omitempty"`
	// contains filtered or unexported fields
}

func GetSimpleStats

func GetSimpleStats() *Stats

func GetStats

func GetStats(s *Proxy, update bool) *Stats

func NewStats

func NewStats() *Stats

func (*Stats) Copy

func (stats *Stats) Copy(s *Stats)

type StatsFlags

type StatsFlags uint32

func (StatsFlags) HasBit

func (s StatsFlags) HasBit(m StatsFlags) bool

Jump to

Keyboard shortcuts

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