Compare commits
1 Commits
v0.8.6
...
4574b32242
| Author | SHA1 | Date | |
|---|---|---|---|
| 4574b32242 |
@@ -11,6 +11,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// RingMax indicates the highest [Ring] identifier
|
||||||
|
RingMax = 4
|
||||||
// RegionMax indicates the highest number that can be used for a [RegionID].
|
// RegionMax indicates the highest number that can be used for a [RegionID].
|
||||||
RegionMax = (1 << 4) - 1
|
RegionMax = (1 << 4) - 1
|
||||||
// ZoneMax indicates the highest number that can be used for a [ZoneID].
|
// ZoneMax indicates the highest number that can be used for a [ZoneID].
|
||||||
@@ -33,6 +35,21 @@ const (
|
|||||||
RingThreeBits = 12
|
RingThreeBits = 12
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// RingID identifies a Ring
|
||||||
|
type RingID int
|
||||||
|
|
||||||
|
// Valid tells a [RingID] is within the valid range.
|
||||||
|
func (n RingID) Valid() bool { return n > 0 && n <= RingMax }
|
||||||
|
|
||||||
|
func (n RingID) String() string {
|
||||||
|
return idString(n)
|
||||||
|
}
|
||||||
|
|
||||||
|
// A Ring identifies what ring an address belongs to
|
||||||
|
type Ring interface {
|
||||||
|
ID() RingID
|
||||||
|
}
|
||||||
|
|
||||||
// RegionID is the identifier of a region, valid between 1 and [RegionMax].
|
// RegionID is the identifier of a region, valid between 1 and [RegionMax].
|
||||||
type RegionID int
|
type RegionID int
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user