LGTM

On Mon, Mar 3, 2014 at 2:48 PM, Klaus Aehlig <[email protected]> wrote:

> Enrich the structure of WConfdMonad by a convenience
> wrapper around modifyLockAllocation for the case that
> the modification always succeeds and does not produce
> any result.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  src/Ganeti/WConfd/Monad.hs | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/src/Ganeti/WConfd/Monad.hs b/src/Ganeti/WConfd/Monad.hs
> index c24dc90..b985f64 100644
> --- a/src/Ganeti/WConfd/Monad.hs
> +++ b/src/Ganeti/WConfd/Monad.hs
> @@ -45,6 +45,7 @@ module Ganeti.WConfd.Monad
>    , modifyConfigState
>    , readConfigState
>    , modifyLockAllocation
> +  , modifyLockAllocation_
>    , readLockAllocation
>    ) where
>
> @@ -175,6 +176,12 @@ modifyLockAllocation f = do
>    atomicModifyIORef (dhDaemonState dh) mf
>    -- TODO: Trigger the async. lock saving worker
>
> +-- | Atomically modifies the lock allocation state in WConfdMonad, not
> +-- producing any result
> +modifyLockAllocation_ :: (GanetiLockAllocation -> GanetiLockAllocation)
> +                      -> WConfdMonad ()
> +modifyLockAllocation_ = modifyLockAllocation . (flip (,) () .)
> +
>  -- | Read the lock allocation state.
>  readLockAllocation :: WConfdMonad GanetiLockAllocation
>  readLockAllocation = liftM dsLockAllocation . readIORef . dhDaemonState
> --
> 1.9.0.279.gdc9e3eb
>
>

Reply via email to