From 4ff773aaaf96237ed56c140638930919efb8298a Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Mon, 23 Dec 2013 16:08:10 -0700 Subject: [PATCH] bump(github.com/coreos/raft): 0c36c972a25343e7e353257284ef6df5c8676a3d --- third_party/github.com/coreos/raft/context.go | 7 +++++++ third_party/github.com/coreos/raft/server.go | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/third_party/github.com/coreos/raft/context.go b/third_party/github.com/coreos/raft/context.go index 2d82df764..bea7aafb7 100644 --- a/third_party/github.com/coreos/raft/context.go +++ b/third_party/github.com/coreos/raft/context.go @@ -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 +} diff --git a/third_party/github.com/coreos/raft/server.go b/third_party/github.com/coreos/raft/server.go index 1d3c830c0..2a02d1aae 100644 --- a/third_party/github.com/coreos/raft/server.go +++ b/third_party/github.com/coreos/raft/server.go @@ -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: