Skip to content

Commit

Permalink
Support retrieving current term
Browse files Browse the repository at this point in the history
  • Loading branch information
otoolep authored Oct 9, 2024
1 parent dd1f3da commit 69a8fd4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,11 @@ func (r *Raft) Stats() map[string]string {
return s
}

// Term returns the current term.
func (r *Raft) Term() uint64 {
return r.getCurrentTerm()
}

// LastIndex returns the last index in stable storage,
// either from the last log or from the last snapshot.
func (r *Raft) LastIndex() uint64 {
Expand Down

0 comments on commit 69a8fd4

Please sign in to comment.