Skip to content
This repository has been archived by the owner on Nov 18, 2017. It is now read-only.

Commit

Permalink
Revert "remove old update chan methods"
Browse files Browse the repository at this point in the history
This reverts commit 368c49e.
  • Loading branch information
Joshua Deare committed Aug 25, 2016
1 parent 483611d commit 2ac38bd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions fsm/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ func (f *fsm) UniqueID() uint64 {
return f.raft.UniqueID()
}

// LeaderCh returns a channel with LeaderUpdates
// LeaderCh does not block. Note: this means if the user is not monitoring
// LeaderCh then the LeaderUpdate will be lost it is the user's
// responsibility to ensure the channel is consumed as aggressively as is needed
// based on expected update to the leader
func (f *fsm) LeaderObserver() (LeaderObserver, error) {
f.observationLock.Lock()
defer f.observationLock.Unlock()
Expand Down Expand Up @@ -257,6 +262,10 @@ type leaderUpdateObserver struct {
id uint64
}

func (l *leaderUpdateObserver) LeaderCh() <-chan LeaderUpdate {
return l.updateCh
}

func (l *leaderUpdateObserver) Destroy() error {
return l.fsm.unregisterLeaderObserver(l)
}
Expand Down Expand Up @@ -327,6 +336,10 @@ type memberUpdateObserver struct {
id uint64
}

func (m *memberUpdateObserver) MemberCh() <-chan MemberUpdate {
return m.updateCh
}

func (m *memberUpdateObserver) Destroy() error {
return m.fsm.unregisterMemberObserver(m)
}
Expand Down

0 comments on commit 2ac38bd

Please sign in to comment.