Commit 6dec5ace authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Support intersecting locks



...in waiting structures. This is just a convenience wrapper
around freeLocksPredicate.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent 639997b9
......@@ -38,6 +38,7 @@ module Ganeti.Locking.Waiting
, fromExtRepr
, freeLocksPredicate
, downGradeLocksPredicate
, intersectLocks
) where
import Control.Arrow ((&&&), second)
......@@ -314,3 +315,10 @@ downGradeLocksPredicate :: (Lock a, Ord b, Ord c)
-> b
-> LockWaiting a b c -> (LockWaiting a b c, S.Set b)
downGradeLocksPredicate = manipulateLocksPredicate L.requestShared
-- | Intersect locks to a given set.
intersectLocks :: (Lock a, Ord b, Ord c)
=> [a]
-> b
-> LockWaiting a b c -> (LockWaiting a b c, S.Set b)
intersectLocks locks = freeLocksPredicate (not . flip elem locks)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment