Revision 80004e70
b/src/Ganeti/Locking/Allocation.hs | ||
---|---|---|
33 | 33 |
, requestShared |
34 | 34 |
, requestRelease |
35 | 35 |
, updateLocks |
36 |
, freeLocks |
|
36 | 37 |
) where |
37 | 38 |
|
38 | 39 |
import Control.Arrow (second, (***)) |
... | ... | |
197 | 198 |
let blocked = S.delete owner . S.unions $ map blockedOn reqs |
198 | 199 |
let state' = foldl (updateLock owner) state reqs |
199 | 200 |
return (if S.null blocked then state' else state, blocked) |
201 |
|
|
202 |
-- | Compute the state after an onwer releases all its locks. |
|
203 |
freeLocks :: (Lock a, Ord b) => LockAllocation a b -> b -> LockAllocation a b |
|
204 |
freeLocks state owner = |
|
205 |
fst . flip (updateLocks owner) state . map requestRelease . M.keys |
|
206 |
$ listLocks owner state |
Also available in: Unified diff