core

package
v0.0.0-...-8e9e43a Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkerStatusStop = 1
	WorkerStatusLive = 0
)

Variables

This section is empty.

Functions

func SafeGo

func SafeGo(t Task)

执行

Types

type ChartApiRsp

type ChartApiRsp struct {
	X []string `json:"x"`
	Y []int32  `json:"y"`
}

type Core

type Core struct {
	SocketAddr       string
	WebAddr          string
	WebsocketUpgrade websocket.Upgrader
	ConnMutex        sync.RWMutex
	Clients          sync.Map // 客户端集合
	TextSafer        component.TextSafe

	IpSearch *component.IpSearch
	// contains filtered or unexported fields
}

Core 核心处理

func NewCore

func NewCore() *Core

NewCore ...

func (*Core) ChartDataApi

func (s *Core) ChartDataApi(w http.ResponseWriter, r *http.Request)

ChartDataApi 统计了一天内在线人数趋势

func (*Core) Run

func (s *Core) Run()

type GoPool

type GoPool struct {
	MaxWorkerIdleTime time.Duration // worker 最大空闲时间
	MaxWorkerNum      int32         // 协程最大数量
	TaskEntryChan     chan Task     // 任务入列
	Workers           []*worker     // 已创建worker
	FreeWorkerChan    chan *worker  // 空闲worker
	Lock              sync.Mutex
}

boss 老板

func NewPool

func NewPool() *GoPool

初始化

type Task

type Task func()

Jump to

Keyboard shortcuts

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