Browse Source

bump(github.com/coreos/raft): ca61124b291fe38a2ab592a8b42f1423e3c31cc4

Ben Johnson 12 years ago
parent
commit
44af8ea190

+ 1 - 2
third_party/github.com/coreos/raft/join_command.go

@@ -2,8 +2,7 @@ package raft
 
 
 // Join command interface
 // Join command interface
 type JoinCommand interface {
 type JoinCommand interface {
-	CommandName() string
-	Apply(server Server) (interface{}, error)
+	Command
 	NodeName() string
 	NodeName() string
 }
 }
 
 

+ 1 - 2
third_party/github.com/coreos/raft/leave_command.go

@@ -2,8 +2,7 @@ package raft
 
 
 // Leave command interface
 // Leave command interface
 type LeaveCommand interface {
 type LeaveCommand interface {
-	CommandName() string
-	Apply(server Server) (interface{}, error)
+	Command
 	NodeName() string
 	NodeName() string
 }
 }
 
 

+ 1 - 5
third_party/github.com/coreos/raft/log.go

@@ -74,11 +74,7 @@ func (l *Log) CommitIndex() uint64 {
 func (l *Log) currentIndex() uint64 {
 func (l *Log) currentIndex() uint64 {
 	l.mutex.RLock()
 	l.mutex.RLock()
 	defer l.mutex.RUnlock()
 	defer l.mutex.RUnlock()
-
-	if len(l.entries) == 0 {
-		return l.startIndex
-	}
-	return l.entries[len(l.entries)-1].Index
+	return l.internalCurrentIndex()
 }
 }
 
 
 // The current index in the log without locking
 // The current index in the log without locking

+ 1 - 1
third_party/github.com/coreos/raft/server.go

@@ -176,7 +176,7 @@ func NewServer(name string, path string, transporter Transporter, stateMachine S
 			return c.Apply(&context{
 			return c.Apply(&context{
 				server:       s,
 				server:       s,
 				currentTerm:  s.currentTerm,
 				currentTerm:  s.currentTerm,
-				currentIndex: s.log.currentIndex(),
+				currentIndex: s.log.internalCurrentIndex(),
 				commitIndex:  s.log.commitIndex,
 				commitIndex:  s.log.commitIndex,
 			})
 			})
 		case deprecatedCommandApply:
 		case deprecatedCommandApply: