From 6fa4c61061e5346f236a36861a3affc954bd36e2 Mon Sep 17 00:00:00 2001 From: Michael Baird Date: Wed, 26 Apr 2017 16:46:18 -0500 Subject: [PATCH] pluralized owns slices function --- cluster.go | 4 ++-- cluster_test.go | 6 +++--- server.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cluster.go b/cluster.go index dacad63ed..0e59c1d6c 100644 --- a/cluster.go +++ b/cluster.go @@ -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) diff --git a/cluster_test.go b/cluster_test.go index 2b668d407..30b30133c 100644 --- a/cluster_test.go +++ b/cluster_test.go @@ -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) diff --git a/server.go b/server.go index d24dec0ba..81bc4d9e2 100644 --- a/server.go +++ b/server.go @@ -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