chore: fix clustering build
Clustering requires taking the hash of synthetic points, so allow this function to work on anything with a HashID.pull/20265/head
parent
d1a1e4b667
commit
d96c8fb125
|
@ -1363,12 +1363,15 @@ func (sgi ShardGroupInfo) clone() ShardGroupInfo {
|
|||
return other
|
||||
}
|
||||
|
||||
// ShardFor returns the ShardInfo for a Point.
|
||||
func (sgi *ShardGroupInfo) ShardFor(p models.Point) ShardInfo {
|
||||
type hashIDer interface {
|
||||
HashID() uint64
|
||||
}
|
||||
|
||||
// ShardFor returns the ShardInfo for a Point or other hashIDer.
|
||||
func (sgi *ShardGroupInfo) ShardFor(p hashIDer) ShardInfo {
|
||||
if len(sgi.Shards) == 1 {
|
||||
return sgi.Shards[0]
|
||||
}
|
||||
|
||||
return sgi.Shards[p.HashID()%uint64(len(sgi.Shards))]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue