实现基本的集群DNS列表、设置、简单数据同步

This commit is contained in:
GoEdgeLab
2020-11-13 18:22:22 +08:00
parent 7f61c82c52
commit f17f987636
51 changed files with 1074 additions and 391 deletions

View File

@@ -125,7 +125,7 @@ func (this *NodeIPAddressDAO) UpdateAddressNodeId(addressId int64, nodeId int64)
return err
}
// 查找某个节点所有的IP地址
// 查找节点所有的IP地址
func (this *NodeIPAddressDAO) FindAllEnabledAddressesWithNode(nodeId int64) (result []*NodeIPAddress, err error) {
_, err = this.Query().
Attr("nodeId", nodeId).
@@ -136,3 +136,15 @@ func (this *NodeIPAddressDAO) FindAllEnabledAddressesWithNode(nodeId int64) (res
FindAll()
return
}
// 查找节点的第一个可访问的IP地址
func (this *NodeIPAddressDAO) FindFirstNodeIPAddress(nodeId int64) (string, error) {
return this.Query().
Attr("nodeId", nodeId).
State(NodeIPAddressStateEnabled).
Attr("canAccess", true).
Desc("order").
AscPk().
Result("ip").
FindStringCol("")
}