mirror of
https://github.com/minio/minio.git
synced 2025-11-20 09:56:07 -05:00
rename zones to serverSets to avoid terminology conflict (#10679)
we are bringing in availability zones, we should avoid zones as per server expansion concept.
This commit is contained in:
@@ -113,19 +113,19 @@ minio server http://host{1...32}/export{1...32} http://host{5...6}/export{1...8}
|
||||
MinIO根据每个区域的可用空间比例将新对象放置在区域中。以下伪代码演示了此行为。
|
||||
```go
|
||||
func getAvailableZoneIdx(ctx context.Context) int {
|
||||
zones := z.getZonesAvailableSpace(ctx)
|
||||
total := zones.TotalAvailable()
|
||||
serverSets := z.getServerSetsAvailableSpace(ctx)
|
||||
total := serverSets.TotalAvailable()
|
||||
// choose when we reach this many
|
||||
choose := rand.Uint64() % total
|
||||
atTotal := uint64(0)
|
||||
for _, zone := range zones {
|
||||
for _, zone := range serverSets {
|
||||
atTotal += zone.Available
|
||||
if atTotal > choose && zone.Available > 0 {
|
||||
return zone.Index
|
||||
}
|
||||
}
|
||||
// Should not happen, but print values just in case.
|
||||
panic(fmt.Errorf("reached end of zones (total: %v, atTotal: %v, choose: %v)", total, atTotal, choose))
|
||||
panic(fmt.Errorf("reached end of serverSets (total: %v, atTotal: %v, choose: %v)", total, atTotal, choose))
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user