cluster: introduce NodeID and ZoneID types
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package cluster
|
||||
|
||||
import "strconv"
|
||||
|
||||
type (
|
||||
// ZoneID is the identifier of a [Zone]
|
||||
ZoneID int
|
||||
// NodeID is the identifier of a [Machine]
|
||||
NodeID int
|
||||
)
|
||||
|
||||
func (z ZoneID) String() string {
|
||||
return idString(int(z))
|
||||
}
|
||||
|
||||
func (n NodeID) String() string {
|
||||
return idString(int(n))
|
||||
}
|
||||
|
||||
func idString(v int) string {
|
||||
if v > 0 {
|
||||
return strconv.Itoa(v)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
Reference in New Issue
Block a user