improve gdb for configiration

This commit is contained in:
John 2019-09-02 20:35:29 +08:00
parent 8f1fd259d4
commit acd5e72f6c
2 changed files with 6 additions and 6 deletions

View File

@ -64,15 +64,15 @@ func SetConfig(config Config) {
configs.config = config
}
// 添加数据库服务器集群配置
func AddConfigGroup(group string, nodes ConfigGroup) {
// 按照配置分组设置数据库服务器集群配置
func SetConfigGroup(group string, nodes ConfigGroup) {
defer instances.Clear()
configs.Lock()
defer configs.Unlock()
configs.config[group] = nodes
}
// 添加一台数据库服务器配置
// 按照配置分组添加一台数据库服务器配置
func AddConfigNode(group string, node ConfigNode) {
defer instances.Clear()
configs.Lock()
@ -87,7 +87,7 @@ func AddDefaultConfigNode(node ConfigNode) {
// 添加默认链接的数据库服务器集群配置
func AddDefaultConfigGroup(nodes ConfigGroup) {
AddConfigGroup(DEFAULT_GROUP_NAME, nodes)
SetConfigGroup(DEFAULT_GROUP_NAME, nodes)
}
// 添加一台数据库服务器配置

View File

@ -124,7 +124,7 @@ func Database(name ...string) gdb.DB {
}
}
if len(cg) > 0 {
gdb.AddConfigGroup(group, cg)
gdb.SetConfigGroup(group, cg)
}
}
// Parse <m> as a single node configuration.
@ -134,7 +134,7 @@ func Database(name ...string) gdb.DB {
cg = append(cg, *node)
}
if len(cg) > 0 {
gdb.AddConfigGroup(group, cg)
gdb.SetConfigGroup(group, cg)
}
}
addConfigMonitor(instanceKey, config)