mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-27 15:46:35 +08:00
提供手动控制节点上下线的接口
This commit is contained in:
@@ -828,7 +828,7 @@ func (this *NodeDAO) UpdateNodeDNS(tx *dbs.Tx, nodeId int64, routes map[int64][]
|
||||
}
|
||||
|
||||
// 计算节点上线|下线状态
|
||||
func (this *NodeDAO) UpdateNodeUp(tx *dbs.Tx, nodeId int64, isUp bool, maxUp int, maxDown int) (changed bool, err error) {
|
||||
func (this *NodeDAO) UpdateNodeUpCount(tx *dbs.Tx, nodeId int64, isUp bool, maxUp int, maxDown int) (changed bool, err error) {
|
||||
if nodeId <= 0 {
|
||||
return false, errors.New("invalid nodeId")
|
||||
}
|
||||
@@ -888,6 +888,23 @@ func (this *NodeDAO) UpdateNodeUp(tx *dbs.Tx, nodeId int64, isUp bool, maxUp int
|
||||
return
|
||||
}
|
||||
|
||||
// 设置节点上下线状态
|
||||
func (this *NodeDAO) UpdateNodeUp(tx *dbs.Tx, nodeId int64, isUp bool) error {
|
||||
if nodeId <= 0 {
|
||||
return errors.New("invalid nodeId")
|
||||
}
|
||||
op := NewNodeOperator()
|
||||
op.Id = nodeId
|
||||
op.IsUp = isUp
|
||||
op.CountDown = 0
|
||||
op.CountDown = 0
|
||||
err := this.Save(tx, op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return this.NotifyDNSUpdate(tx, nodeId)
|
||||
}
|
||||
|
||||
// 修改节点活跃状态
|
||||
func (this *NodeDAO) UpdateNodeActive(tx *dbs.Tx, nodeId int64, isActive bool) error {
|
||||
if nodeId <= 0 {
|
||||
|
||||
Reference in New Issue
Block a user