cluster: introduce NodeID and ZoneID types
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -19,7 +19,7 @@ type Zone struct {
|
||||
zones *Cluster
|
||||
logger `json:"-" yaml:"-"`
|
||||
|
||||
ID int
|
||||
ID ZoneID
|
||||
Name string
|
||||
Regions []string `json:",omitempty" yaml:",omitempty"`
|
||||
|
||||
@@ -31,7 +31,7 @@ func (z *Zone) String() string {
|
||||
}
|
||||
|
||||
// SetGateway configures a machine to be the zone's ring0 gateway
|
||||
func (z *Zone) SetGateway(gatewayID int, enabled bool) error {
|
||||
func (z *Zone) SetGateway(gatewayID NodeID, enabled bool) error {
|
||||
var err error
|
||||
var found bool
|
||||
|
||||
@@ -56,8 +56,8 @@ func (z *Zone) SetGateway(gatewayID int, enabled bool) error {
|
||||
}
|
||||
|
||||
// GatewayIDs returns the list of IDs of machines that act as ring0 gateways
|
||||
func (z *Zone) GatewayIDs() ([]int, int) {
|
||||
var out []int
|
||||
func (z *Zone) GatewayIDs() ([]NodeID, int) {
|
||||
var out []NodeID
|
||||
z.ForEachMachine(func(p *Machine) bool {
|
||||
if p.IsGateway() {
|
||||
out = append(out, p.ID)
|
||||
|
||||
Reference in New Issue
Block a user