Documentation
¶
Index ¶
- Variables
- func AllSystemInit(ctx context.Context)
- func InitSystem(ctx context.Context, noDeferFuncList []NoDeferFunc) error
- func InitSystemDeferFunc(ctx context.Context) ([]func(context.Context) error, error)
- func InitTrace(ctx context.Context)
- func RunQueue(ctx context.Context) (error, func(context.Context) error)
- func RunServer(ctx context.Context, stopSignal chan os.Signal)
- func RunSystemAnalysis(stopSignal chan os.Signal, pprofPort string)
- func SetGFMode(ctx context.Context)
- type DeferFunc
- type NoDeferFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var InitFuncNoDeferListForIotCore = []NoDeferFunc{ {model.InitCoreLogic, "核心处理逻辑"}, {service.TSLTable().CreateDatabase, "时序数据库创建"}, {service.TdLogTable().CreateStable, "时序库日志表创建"}, {service.DevInit().InitProductForTd, "时序库产品表初始化"}, {service.DevInit().InitDeviceForTd, "时序库设备表初始化"}, {service.DevDevice().CacheDeviceDetailList, "缓存设备信息"}, {service.AlarmRule().CacheAllAlarmRule, "缓存告警规则"}, {network.ReloadNetwork, "网络服务"}, }
View Source
var InitFuncNoDeferListWebAdmin = []NoDeferFunc{ {service.SysAuthorize().InitAuthorize, "系统权限"}, {initSystemStatistics, "系统统计"}, {service.SysInfo().ServerInfoEscalation, "集群数据"}, {initPlugins, "插件"}, }
View Source
var ( Main = gcmd.Command{ Name: "main", Usage: "main", Brief: "start sagoo-iot server", Func: func(ctx context.Context, parser *gcmd.Parser) (err error) { var signalChannel = make(chan os.Signal, 1) enablePProf := g.Cfg().MustGet(context.Background(), "system.enablePProf").Bool() if enablePProf { pprofPort := g.Cfg().MustGet(context.Background(), "system.pprofPort").String() if pprofPort == "" { pprofPort = "58089" } RunSystemAnalysis(signalChannel, pprofPort) } deferFuncListIotCore, err := InitSystemDeferFunc(ctx) defer func() { for _, f := range deferFuncListIotCore { if f == nil { continue } if deferErr := f(ctx); deferErr != nil { fmt.Printf("defer func error: %s\n", deferErr.Error()) } } }() err = InitSystem(ctx, InitFuncNoDeferListForIotCore) if err != nil { fmt.Printf("defer func error: %s\n", err.Error()) } err = InitSystem(ctx, InitFuncNoDeferListWebAdmin) if err != nil { fmt.Printf("defer func error: %s\n", err.Error()) } sse.Init() RunServer(ctx, signalChannel) signal.Notify(signalChannel, os.Interrupt, os.Kill, syscall.SIGTERM) fmt.Println("收到关闭服务信号:", <-signalChannel) time.Sleep(time.Second * 3) tdengine.Close() fmt.Println("成功关闭服务器") return }, } )
Functions ¶
func AllSystemInit ¶
func InitSystem ¶
func InitSystem(ctx context.Context, noDeferFuncList []NoDeferFunc) error
func InitSystemDeferFunc ¶
func RunSystemAnalysis ¶
Types ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.