From 2ac38bddf474318d8302b8fdf80792962064b448 Mon Sep 17 00:00:00 2001 From: Joshua Deare Date: Thu, 25 Aug 2016 13:46:44 -0700 Subject: [PATCH] Revert "remove old update chan methods" This reverts commit 368c49e668fe9f87dbd5af1fd89dad05913295df. --- fsm/fsm.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fsm/fsm.go b/fsm/fsm.go index 801505db..1c55139e 100644 --- a/fsm/fsm.go +++ b/fsm/fsm.go @@ -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() @@ -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) } @@ -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) }