mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-15 20:06:19 +08:00
add dataCenter option when assign file keys
add dataCenter option when starting volume servers some work related to freeze a volume. Not tested yet.
This commit is contained in:
@@ -46,11 +46,20 @@ func (c *Configuration) String() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (c *Configuration) Locate(ip string) (dc string, rack string) {
|
||||
if c != nil && c.ip2location != nil {
|
||||
if loc, ok := c.ip2location[ip]; ok {
|
||||
return loc.dcName, loc.rackName
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
return "DefaultDataCenter", "DefaultRack"
|
||||
}
|
||||
|
Reference in New Issue
Block a user