bump(github.com/coreos/raft): 0c36c972a25343e7e353257284ef6df5c8676a3d

This commit is contained in:
Ben Johnson 2013-12-23 16:08:10 -07:00
parent 0611c81e88
commit 4ff773aaaf
2 changed files with 13 additions and 1 deletions

View File

@ -7,6 +7,7 @@ type Context interface {
Server() Server
CurrentTerm() uint64
CurrentIndex() uint64
CommitIndex() uint64
}
// context is the concrete implementation of Context.
@ -14,6 +15,7 @@ type context struct {
server Server
currentIndex uint64
currentTerm uint64
commitIndex uint64
}
// Server returns a reference to the server.
@ -30,3 +32,8 @@ func (c *context) CurrentTerm() uint64 {
func (c *context) CurrentIndex() uint64 {
return c.currentIndex
}
// CommitIndex returns last commit index the server is at.
func (c *context) CommitIndex() uint64 {
return c.commitIndex
}

View File

@ -173,7 +173,12 @@ func NewServer(name string, path string, transporter Transporter, stateMachine S
s.log.ApplyFunc = func(c Command) (interface{}, error) {
switch c := c.(type) {
case CommandApply:
return c.Apply(&context{server: s, currentTerm: s.currentTerm, currentIndex: s.log.currentIndex()})
return c.Apply(&context{
server: s,
currentTerm: s.currentTerm,
currentIndex: s.log.currentIndex(),
commitIndex: s.log.commitIndex,
})
case deprecatedCommandApply:
return c.Apply(s)
default: