LGTM
On Wed, Jun 4, 2014 at 10:20 AM, 'Klaus Aehlig' via ganeti-devel < [email protected]> wrote: > Make WConfdMonad expose a read-only version of the lock waiting > structure. In this way, questions about pending owners can be > answered easily by the daemon. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > src/Ganeti/WConfd/Monad.hs | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/src/Ganeti/WConfd/Monad.hs b/src/Ganeti/WConfd/Monad.hs > index 3e459a9..a8ecfc5 100644 > --- a/src/Ganeti/WConfd/Monad.hs > +++ b/src/Ganeti/WConfd/Monad.hs > @@ -47,6 +47,7 @@ module Ganeti.WConfd.Monad > , readConfigState > , modifyLockWaiting > , modifyLockWaiting_ > + , readLockWaiting > , readLockAllocation > , modifyTempResState > , modifyTempResStateErr > @@ -281,8 +282,13 @@ modifyLockWaiting_ :: (GanetiLockWaiting -> > (GanetiLockWaiting, S.Set ClientId)) > -> WConfdMonad () > modifyLockWaiting_ = modifyLockWaiting . ((second $ (,) ()) .) > > +-- | Read the lock waiting state in WConfdMonad. > +readLockWaiting :: WConfdMonad GanetiLockWaiting > +readLockWaiting = liftM dsLockWaiting > + . readIORef . dhDaemonState > + =<< daemonHandle > + > + > -- | Read the underlying lock allocation. > readLockAllocation :: WConfdMonad (LockAllocation GanetiLocks ClientId) > -readLockAllocation = liftM (getAllocation . dsLockWaiting) > - . readIORef . dhDaemonState > - =<< daemonHandle > +readLockAllocation = liftM getAllocation readLockWaiting > -- > 1.9.1.423.g4596e3a > >
