1 Star 0 Fork 2

who7708 / etcd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
context.go 918 Bytes
一键复制 编辑 原始数据 按行查看 历史
Ben Johnson 提交于 2014-03-24 15:09 . bump(github.com/goraft/raft): 6bf34b9
package raft
// Context represents the current state of the server. It is passed into
// a command when the command is being applied since the server methods
// are locked.
type Context interface {
Server() Server
CurrentTerm() uint64
CurrentIndex() uint64
CommitIndex() uint64
}
// context is the concrete implementation of Context.
type context struct {
server Server
currentIndex uint64
currentTerm uint64
commitIndex uint64
}
// Server returns a reference to the server.
func (c *context) Server() Server {
return c.server
}
// CurrentTerm returns current term the server is in.
func (c *context) CurrentTerm() uint64 {
return c.currentTerm
}
// CurrentIndex returns current index the server is at.
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
}
1
https://gitee.com/who7708/etcd.git
git@gitee.com:who7708/etcd.git
who7708
etcd
etcd
v0.4.8

搜索帮助