Browse Source

raft/auorum: remove unused type

Tobias Schottdorf 6 years ago
parent
commit
9553994cd7
2 changed files with 2 additions and 11 deletions
  1. 2 4
      raft/quorum/majority.go
  2. 0 7
      raft/util.go

+ 2 - 4
raft/quorum/majority.go

@@ -112,9 +112,7 @@ func (c MajorityConfig) Slice() []uint64 {
 	return sl
 }
 
-type uint64Slice []uint64
-
-func insertionSort(sl uint64Slice) {
+func insertionSort(sl []uint64) {
 	a, b := 0, len(sl)
 	for i := a + 1; i < b; i++ {
 		for j := i; j > a && sl[j] < sl[j-1]; j-- {
@@ -141,7 +139,7 @@ func (c MajorityConfig) CommittedIndex(l AckedIndexer) Index {
 	// performance is a lesser concern (additionally the performance
 	// implications of an allocation here are far from drastic).
 	var stk [7]uint64
-	srt := uint64Slice(stk[:])
+	srt := []uint64(stk[:])
 
 	if cap(srt) < n {
 		srt = make([]uint64, n)

+ 0 - 7
raft/util.go

@@ -25,13 +25,6 @@ func (st StateType) MarshalJSON() ([]byte, error) {
 	return []byte(fmt.Sprintf("%q", st.String())), nil
 }
 
-// uint64Slice implements sort interface
-type uint64Slice []uint64
-
-func (p uint64Slice) Len() int           { return len(p) }
-func (p uint64Slice) Less(i, j int) bool { return p[i] < p[j] }
-func (p uint64Slice) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }
-
 func min(a, b uint64) uint64 {
 	if a > b {
 		return b