|
|
@ -147,7 +147,7 @@ func (m *Cluster) finishRegion(r *Region) { |
|
|
|
r.m = m |
|
|
|
r.m = m |
|
|
|
sub := []string{} |
|
|
|
sub := []string{} |
|
|
|
for _, name := range r.Regions { |
|
|
|
for _, name := range r.Regions { |
|
|
|
r2, ok := m.getRegion(name) |
|
|
|
r2, ok := m.getFinishRegion(name) |
|
|
|
if !ok { |
|
|
|
if !ok { |
|
|
|
m.warn(nil).WithField("region", name).Print("unknown region") |
|
|
|
m.warn(nil).WithField("region", name).Print("unknown region") |
|
|
|
continue |
|
|
|
continue |
|
|
@ -162,9 +162,7 @@ func (m *Cluster) finishRegion(r *Region) { |
|
|
|
func (m *Cluster) getRegion(name string) (*Region, bool) { |
|
|
|
func (m *Cluster) getRegion(name string) (*Region, bool) { |
|
|
|
for i := range m.Regions { |
|
|
|
for i := range m.Regions { |
|
|
|
r := &m.Regions[i] |
|
|
|
r := &m.Regions[i] |
|
|
|
|
|
|
|
|
|
|
|
if name == r.Name { |
|
|
|
if name == r.Name { |
|
|
|
m.finishRegion(r) |
|
|
|
|
|
|
|
return r, true |
|
|
|
return r, true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -172,6 +170,15 @@ func (m *Cluster) getRegion(name string) (*Region, bool) { |
|
|
|
return nil, false |
|
|
|
return nil, false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (m *Cluster) getFinishRegion(name string) (*Region, bool) { |
|
|
|
|
|
|
|
if r, ok := m.getRegion(name); ok { |
|
|
|
|
|
|
|
m.finishRegion(r) |
|
|
|
|
|
|
|
return r, true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return nil, false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// SyncRegions writes to the file system the regions this [Zone]
|
|
|
|
// SyncRegions writes to the file system the regions this [Zone]
|
|
|
|
// belongs to.
|
|
|
|
// belongs to.
|
|
|
|
func (z *Zone) SyncRegions() error { |
|
|
|
func (z *Zone) SyncRegions() error { |
|
|
|