mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-15 20:06:19 +08:00
1. refactoring, merge "replication" logic into "topology" package
2. when growing volumes, additional preferred "rack" and "dataNode" paraemters are also provided. Previously only "dataCenter" paraemter is provided.
This commit is contained in:
@@ -47,19 +47,19 @@ func (c *Configuration) String() string {
|
||||
}
|
||||
|
||||
func (c *Configuration) Locate(ip string, dcName string, rackName string) (dc string, rack string) {
|
||||
if dcName == "" {
|
||||
if c != nil && c.ip2location != nil {
|
||||
if loc, ok := c.ip2location[ip]; ok {
|
||||
return loc.dcName, loc.rackName
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if rackName == "" {
|
||||
return dcName, "DefaultRack"
|
||||
} else {
|
||||
return dcName, rackName
|
||||
if c != nil && c.ip2location != nil {
|
||||
if loc, ok := c.ip2location[ip]; ok {
|
||||
return loc.dcName, loc.rackName
|
||||
}
|
||||
}
|
||||
|
||||
return "DefaultDataCenter", "DefaultRack"
|
||||
if dcName == "" {
|
||||
dcName = "DefaultDataCenter"
|
||||
}
|
||||
|
||||
if rackName == "" {
|
||||
rackName = "DefaultRack"
|
||||
}
|
||||
|
||||
return dcName, rackName
|
||||
}
|
||||
|
Reference in New Issue
Block a user