featurebase/dax/versioned_partition.go
Matthew Jaffee e09a9dca47 first cut at removing all the shard/field/partition versioning
some cleanup needed

(cherry picked from commit bc9057f492)
2023-01-10 23:27:40 +00:00

26 lines
689 B
Go

package dax
import "fmt"
// PartitionNum is the numerical (int) partition value.
type PartitionNum int
// PartitionNums is a slice of PartitionNum.
type PartitionNums []PartitionNum
func (p PartitionNums) Len() int { return len(p) }
func (p PartitionNums) Less(i, j int) bool { return p[i] < p[j] }
func (p PartitionNums) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// String returns the PartitionNum as a string.
func (p PartitionNum) String() string {
return fmt.Sprintf("%d", p)
}
func NewPartitionNums(nums ...uint64) PartitionNums {
partitions := make(PartitionNums, len(nums))
for i, n := range nums {
partitions[i] = PartitionNum(n)
}
return partitions
}