LGTM

On Wed, Jun 4, 2014 at 10:20 AM, 'Klaus Aehlig' via ganeti-devel <
[email protected]> wrote:

> Add a predicate telling whether a given owner has a pending
> request. In this way, an owner can poll for his request: if
> he does not have a pending request, his previous asynchronous
> request has been granted.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  src/Ganeti/Locking/Waiting.hs | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/Ganeti/Locking/Waiting.hs b/src/Ganeti/Locking/Waiting.hs
> index 9096ddc..a16ce88 100644
> --- a/src/Ganeti/Locking/Waiting.hs
> +++ b/src/Ganeti/Locking/Waiting.hs
> @@ -31,6 +31,7 @@ module Ganeti.Locking.Waiting
>   , updateLocksWaiting
>   , getAllocation
>   , getPendingOwners
> + , hasPendingRequest
>   , removePendingRequest
>   , releaseResources
>   , getPendingRequests
> @@ -101,6 +102,10 @@ emptyWaiting =
>  getPendingOwners :: LockWaiting a b c -> S.Set b
>  getPendingOwners = M.keysSet . lwPendingOwners
>
> +-- | Predicate on whether an owner has a pending lock request.
> +hasPendingRequest :: Ord b => b -> LockWaiting a b c -> Bool
> +hasPendingRequest owner = M.member owner . lwPendingOwners
> +
>  -- | Get the allocation state from the waiting state
>  getAllocation :: LockWaiting a b c -> L.LockAllocation a b
>  getAllocation = lwAllocation
> --
> 1.9.1.423.g4596e3a
>
>

Reply via email to