From 7a50cd7074a8e24c3fc6f8403f9f25b9b281969f Mon Sep 17 00:00:00 2001 From: Tobias Schottdorf Date: Wed, 31 Jul 2019 11:39:06 +0200 Subject: [PATCH] raft/auorum: remove unused type --- raft/quorum/majority.go | 6 ++---- raft/util.go | 7 ------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/raft/quorum/majority.go b/raft/quorum/majority.go index 9b10e9583..a53f9a4d8 100644 --- a/raft/quorum/majority.go +++ b/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) diff --git a/raft/util.go b/raft/util.go index c145d26dd..c44e3550a 100644 --- a/raft/util.go +++ b/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