|
|
|
@ -32,18 +32,24 @@ type Zones struct {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ForEachMachine calls a function for each Machine in the cluster
|
|
|
|
|
func (m *Zones) ForEachMachine(fn func(*Machine)) { |
|
|
|
|
func (m *Zones) ForEachMachine(fn func(*Machine) bool) { |
|
|
|
|
for _, z := range m.Zones { |
|
|
|
|
for _, p := range z.Machines { |
|
|
|
|
fn(p) |
|
|
|
|
if fn(p) { |
|
|
|
|
// terminate
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ForEachZone calls a function for each Zone in the cluster
|
|
|
|
|
func (m *Zones) ForEachZone(fn func(*Zone)) { |
|
|
|
|
func (m *Zones) ForEachZone(fn func(*Zone) bool) { |
|
|
|
|
for _, p := range m.Zones { |
|
|
|
|
fn(p) |
|
|
|
|
if fn(p) { |
|
|
|
|
// terminate
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|