增加节点IP地址管理等功能

This commit is contained in:
GoEdgeLab
2020-08-30 16:12:00 +08:00
parent 8fedd221fc
commit f8049b3739
25 changed files with 3945 additions and 311 deletions

View File

@@ -169,14 +169,19 @@ func (this *NodeDAO) CountAllEnabledNodes() (int64, error) {
}
// 列出单页节点
func (this *NodeDAO) ListEnabledNodes(offset int64, size int64) (result []*Node, err error) {
_, err = this.Query().
func (this *NodeDAO) ListEnabledNodesMatch(offset int64, size int64, clusterId int64) (result []*Node, err error) {
query := this.Query().
State(NodeStateEnabled).
Offset(offset).
Limit(size).
DescPk().
Slice(&result).
FindAll()
Slice(&result)
if clusterId > 0 {
query.Attr("clusterId", clusterId)
}
_, err = query.FindAll()
return
}
@@ -236,6 +241,16 @@ func (this *NodeDAO) FindAllNodeIdsMatch(clusterId int64) (result []int64, err e
return
}
// 计算节点数量
func (this *NodeDAO) CountAllEnabledNodesMatch(clusterId int64) (int64, error) {
query := this.Query()
query.State(NodeStateEnabled)
if clusterId > 0 {
query.Attr("clusterId", clusterId)
}
return query.Count()
}
// 更改节点状态
func (this *NodeDAO) UpdateNodeStatus(nodeId int64, statusJSON []byte) error {
_, err := this.Query().