Documentation
¶
Index ¶
- Constants
- type DiskStats
- type HealthCheck
- type NetworkStats
- type System
- func (s *System) EmitEvent(evt SystemEvent)
- func (s *System) GetStatus() types.SystemStatus
- func (s *System) Initialize(ctx context.Context) error
- func (s *System) Shutdown(ctx context.Context) error
- func (s *System) Start() error
- func (s *System) Stop() error
- func (s *System) UpdateConfig(newConfig SystemConfig) error
- func (s *System) UpdateMetrics()
- type SystemConfig
- type SystemEvent
- type SystemMetrics
- type SystemOptions
- type SystemResources
Constants ¶
View Source
const ( SystemStateInitialized = "initialized" SystemStateRunning = "running" SystemStateStopping = "stopping" SystemStateStopped = "stopped" SystemStateError = "error" )
添加系统状态常量
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HealthCheck ¶
type HealthCheck struct {
Name string
Check func() error
Interval time.Duration
Timeout time.Duration
Required bool
}
添加健康检查
type NetworkStats ¶
type System ¶
type System struct {
// contains filtered or unexported fields
}
System DaoFlow系统主结构
func (*System) EmitEvent ¶
func (s *System) EmitEvent(evt SystemEvent)
func (*System) UpdateConfig ¶
func (s *System) UpdateConfig(newConfig SystemConfig) error
type SystemConfig ¶
type SystemConfig struct {
Basic BasicConfig
Meta MetaConfig
Evolution EvolutionConfig
Control ControlConfig
Monitor MonitorConfig
Resources ResourceConfig
}
添加动态配置支持
type SystemEvent ¶
type SystemEvent struct {
Type string
Source string
Timestamp time.Time
Data map[string]interface{}
}
添加事件系统
type SystemMetrics ¶
type SystemMetrics struct {
Uptime time.Duration // 运行时间
MemoryUsage uint64 // 内存使用
CPUUsage float64 // CPU使用率
GoroutineCount int // 协程数量
ErrorCount int64 // 错误计数
EventCount int64 // 事件计数
// 新增指标
HeapObjects uint64 // 堆对象数
HeapAlloc uint64 // 堆分配量
GCPause time.Duration // GC暂停时间
ThreadCount int // 线程数
MutexWait int64 // 互斥锁等待次数
NetworkIO NetworkStats // 网络IO统计
DiskIO DiskStats // 磁盘IO统计
}
SystemMetrics 系统指标
type SystemOptions ¶
SystemOptions 系统配置选项
type SystemResources ¶
type SystemResources struct {
CPU *CPUResource
Memory *MemoryResource
Network *NetworkResource
Disk *DiskResource
}
添加资源管理
Click to show internal directories.
Click to hide internal directories.