LGTM
On Mon, Mar 3, 2014 at 2:48 PM, Klaus Aehlig <[email protected]> wrote: > As opposed to the atomic modify-and-read provided my modifyLockAllocation, > no storing is necessary here. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > src/Ganeti/WConfd/Monad.hs | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/src/Ganeti/WConfd/Monad.hs b/src/Ganeti/WConfd/Monad.hs > index 4271e07..c24dc90 100644 > --- a/src/Ganeti/WConfd/Monad.hs > +++ b/src/Ganeti/WConfd/Monad.hs > @@ -45,6 +45,7 @@ module Ganeti.WConfd.Monad > , modifyConfigState > , readConfigState > , modifyLockAllocation > + , readLockAllocation > ) where > > import Control.Applicative > @@ -173,3 +174,8 @@ modifyLockAllocation f = do > in (ds { dsLockAllocation = la' }, r) > atomicModifyIORef (dhDaemonState dh) mf > -- TODO: Trigger the async. lock saving worker > + > +-- | Read the lock allocation state. > +readLockAllocation :: WConfdMonad GanetiLockAllocation > +readLockAllocation = liftM dsLockAllocation . readIORef . dhDaemonState > + =<< daemonHandle > -- > 1.9.0.279.gdc9e3eb > >
