cluster: use rings.ZoneID and rings.NodeID types
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -2,6 +2,8 @@ package cluster
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
|
||||
"git.jpi.io/amery/jpictl/pkg/rings"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -19,7 +21,7 @@ type Zone struct {
|
||||
zones *Cluster
|
||||
logger `json:"-" yaml:"-"`
|
||||
|
||||
ID int
|
||||
ID rings.ZoneID
|
||||
Name string
|
||||
Regions []string `json:",omitempty" yaml:",omitempty"`
|
||||
|
||||
@@ -31,7 +33,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 rings.NodeID, enabled bool) error {
|
||||
var err error
|
||||
var found bool
|
||||
|
||||
@@ -56,8 +58,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() ([]rings.NodeID, int) {
|
||||
var out []rings.NodeID
|
||||
z.ForEachMachine(func(p *Machine) bool {
|
||||
if p.IsGateway() {
|
||||
out = append(out, p.ID)
|
||||
|
||||
Reference in New Issue
Block a user