pluralized owns slices function

This commit is contained in:
Michael Baird 2017-04-26 16:46:18 -05:00
parent 6a8e205769
commit 6fa4c61061
3 changed files with 6 additions and 6 deletions

View file

@ -225,8 +225,8 @@ func (c *Cluster) PartitionNodes(partitionID int) []*Node {
return nodes
}
// OwnsSlice find the set of slices owned by the node per Index
func (c *Cluster) OwnsSlice(index string, maxSlice uint64, host string) []uint64 {
// OwnsSlices find the set of slices owned by the node per Index
func (c *Cluster) OwnsSlices(index string, maxSlice uint64, host string) []uint64 {
var slices []uint64
for i := uint64(0); i <= maxSlice; i++ {
p := c.Partition(index, i)

View file

@ -118,10 +118,10 @@ func TestCluster_NodeStates(t *testing.T) {
}
}
// Ensure OwnsSlice can find the actual slice list for node and index
func TestCluster_OwnsSlice(t *testing.T) {
// Ensure OwnsSlices can find the actual slice list for node and index
func TestCluster_OwnsSlices(t *testing.T) {
c := NewCluster(5)
slices := c.OwnsSlice("test", 10, "host2")
slices := c.OwnsSlices("test", 10, "host2")
if !reflect.DeepEqual(slices, []uint64{1, 3, 10}) {
t.Fatalf("unexpected slices for node's index: %v", slices)

View file

@ -298,7 +298,7 @@ func (s *Server) LocalStatus() (proto.Message, error) {
// Append Slice list per this Node's indexes
for _, index := range ns.Indexes {
index.Slices = s.Cluster.OwnsSlice(index.Name, index.MaxSlice, s.Host)
index.Slices = s.Cluster.OwnsSlices(index.Name, index.MaxSlice, s.Host)
}
return &ns, nil