parent
b86fecfd80
commit
80248f9b53
|
@ -21,7 +21,6 @@ type raftState interface {
|
|||
initialize() error
|
||||
leader() string
|
||||
isLeader() bool
|
||||
leaderCh() <-chan bool
|
||||
raftEnabled() bool
|
||||
sync(index uint64, timeout time.Duration) error
|
||||
setPeers(addrs []string) error
|
||||
|
@ -185,13 +184,6 @@ func (r *localRaft) isLeader() bool {
|
|||
return r.store.raft.State() == raft.Leader
|
||||
}
|
||||
|
||||
func (r *localRaft) leaderCh() <-chan bool {
|
||||
r.store.mu.RLock()
|
||||
defer r.store.mu.RUnlock()
|
||||
assert(r.store.raft != nil, "cannot retrieve leadership channel when closed")
|
||||
return r.store.raft.LeaderCh()
|
||||
}
|
||||
|
||||
// remoteRaft is a consensus strategy that uses a remote raft cluster for
|
||||
// consensus operations.
|
||||
type remoteRaft struct {
|
||||
|
@ -202,10 +194,6 @@ func (r *remoteRaft) raftEnabled() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (r *remoteRaft) leaderCh() <-chan bool {
|
||||
panic("cannot retrieve leadership channel using remote raft")
|
||||
}
|
||||
|
||||
func (r *remoteRaft) updateMetaData(ms *Data) {
|
||||
if ms == nil {
|
||||
return
|
||||
|
|
|
@ -440,12 +440,6 @@ func (s *Store) Leader() string {
|
|||
return s.raftState.leader()
|
||||
}
|
||||
|
||||
// LeaderCh returns a channel that notifies on leadership change.
|
||||
// Panics when the store has not been opened yet.
|
||||
func (s *Store) LeaderCh() <-chan bool {
|
||||
return s.raftState.leaderCh()
|
||||
}
|
||||
|
||||
// SetPeers sets a list of peers in the cluster.
|
||||
func (s *Store) SetPeers(addrs []string) error {
|
||||
return s.raftState.setPeers(addrs)
|
||||
|
|
Loading…
Reference in New Issue