37 lines
710 B
Go
37 lines
710 B
Go
package g
|
||
|
||
import (
|
||
logger2 "agent-go/logger"
|
||
"github.com/panjf2000/ants/v2"
|
||
"github.com/spf13/viper"
|
||
)
|
||
|
||
type Global struct {
|
||
AgentHasRegister bool
|
||
NacosConfig *viper.Viper
|
||
P *ants.Pool
|
||
}
|
||
|
||
const (
|
||
QueueDirect = "direct"
|
||
QueueTopic = "topic"
|
||
ExecOmType = "EXECUTOR"
|
||
StatusOmType = "STATUS"
|
||
InitOmType = "INIT"
|
||
)
|
||
|
||
var pool, _ = ants.NewPool(100, ants.WithNonblocking(true), ants.WithLogger(logger2.Log))
|
||
|
||
var G = NewGlobal(
|
||
pool,
|
||
)
|
||
|
||
// NewGlobal NewGlobal构造函数返回一个新的Global实例,其中包含指定的Logger。
|
||
func NewGlobal(pool *ants.Pool) *Global {
|
||
return &Global{
|
||
AgentHasRegister: false,
|
||
NacosConfig: nil,
|
||
P: pool,
|
||
}
|
||
}
|