1 Star 1 Fork 0

hh/etcd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
server_v2.go 1.12 KB
一键复制 编辑 原始数据 按行查看 历史
Ben Johnson 提交于 2014-03-24 15:09 . bump(github.com/goraft/raft): 6bf34b9
package mock
import (
"net/http"
"github.com/coreos/etcd/store"
"github.com/coreos/etcd/third_party/github.com/goraft/raft"
"github.com/stretchr/testify/mock"
)
// A mock Server for the v2 handlers.
type ServerV2 struct {
mock.Mock
store store.Store
}
func NewServerV2(store store.Store) *ServerV2 {
return &ServerV2{
store: store,
}
}
func (s *ServerV2) State() string {
args := s.Called()
return args.String(0)
}
func (s *ServerV2) Leader() string {
args := s.Called()
return args.String(0)
}
func (s *ServerV2) CommitIndex() uint64 {
args := s.Called()
return args.Get(0).(uint64)
}
func (s *ServerV2) Term() uint64 {
args := s.Called()
return args.Get(0).(uint64)
}
func (s *ServerV2) PeerURL(name string) (string, bool) {
args := s.Called(name)
return args.String(0), args.Bool(1)
}
func (s *ServerV2) ClientURL(name string) (string, bool) {
args := s.Called(name)
return args.String(0), args.Bool(1)
}
func (s *ServerV2) Store() store.Store {
return s.store
}
func (s *ServerV2) Dispatch(c raft.Command, w http.ResponseWriter, req *http.Request) error {
args := s.Called(c, w, req)
return args.Error(0)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/w1229748769/etcd.git
git@gitee.com:w1229748769/etcd.git
w1229748769
etcd
etcd
v0.4.1

搜索帮助