1 Star 0 Fork 0

lin2631/sc-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
event.go 1.30 KB
一键复制 编辑 原始数据 按行查看 历史
lin2631 提交于 2022-10-29 20:33 . start write the main logic
////定义了集群内发生事件的各种事件类型
package core
type IEvent interface {
HappenTime() int64
ObjectType() EventObjectType
}
type EventObjectType uint8
const (
E_MACHINE EventObjectType = iota
E_INSTANCE
)
type Event struct {
Time int64
Object EventObjectType
}
func (e *Event) HappenTime() int64 {
return e.Time
}
func (e *Event) ObjectType() EventObjectType {
return e.Object
}
type InstanceEvent struct {
Event
Type int64
InstanceId InstanceKey
CpuRequest float64
RamRequest float64
MachineID MachineID
AllocID int64
ScheduleClass int64
Priority int64
}
const (
INSTANCESubmit int64 = 0
INSTANCEQueue int64 = 1
INSTANCEEnable int64 = 2
INSTANCESchdule int64 = 3
INSTANCEEvict int64 = 4
INSTANCEFail int64 = 5
INSTANCEFinish int64 = 6
INSTANCEKill int64 = 7
INSTANCELost int64 = 8
INSTANCEUpdatePending int64 = 9
INSTANCEUpdateRunning int64 = 10
)
type UsageEvent struct {
Event
InstanceId InstanceKey
CpuUsage float64
RamUsage float64
MachineID int64
}
const (
MACHINEAdd int64 = 1
MACHINEDelete int64 = 2
MACHINEUpdate int64 = 3
)
type MachineEvent struct {
Event
MachineId MachineID
Type int64
CpuCapacity float64
RamCapacity float64
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lin2631/sc-go.git
git@gitee.com:lin2631/sc-go.git
lin2631
sc-go
sc-go
467849e1f467

搜索帮助