mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
bump(github.com/coreos/raft): 0c36c972a25343e7e353257284ef6df5c8676a3d
This commit is contained in:
parent
0611c81e88
commit
4ff773aaaf
@ -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
|
||||
}
|
||||
|
7
third_party/github.com/coreos/raft/server.go
vendored
7
third_party/github.com/coreos/raft/server.go
vendored
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user