Revision c8751a72 src/Ganeti/Locking/Locks.hs
b/src/Ganeti/Locking/Locks.hs | ||
---|---|---|
26 | 26 |
module Ganeti.Locking.Locks |
27 | 27 |
( GanetiLocks(..) |
28 | 28 |
, GanetiLockAllocation |
29 |
, loadLockAllocation |
|
29 | 30 |
) where |
30 | 31 |
|
31 |
import Control.Monad (liftM) |
|
32 |
import Control.Monad (liftM, (>=>))
|
|
32 | 33 |
import qualified Text.JSON as J |
33 | 34 |
|
34 |
import Ganeti.JSON (asJSObject, fromObj) |
|
35 |
|
|
36 |
import Ganeti.BasicTypes |
|
37 |
import Ganeti.Errors (ResultG) |
|
38 |
import Ganeti.JSON (asJSObject, fromObj, fromJResultE) |
|
35 | 39 |
import Ganeti.Locking.Allocation |
36 | 40 |
import Ganeti.Locking.Types |
37 | 41 |
import Ganeti.Types |
... | ... | |
66 | 70 |
-- | The type of lock Allocations in Ganeti. In Ganeti, the owner of |
67 | 71 |
-- locks are jobs. |
68 | 72 |
type GanetiLockAllocation = LockAllocation GanetiLocks JobId |
73 |
|
|
74 |
-- | Load a lock allocation from disk. |
|
75 |
loadLockAllocation :: FilePath -> ResultG GanetiLockAllocation |
|
76 |
loadLockAllocation = |
|
77 |
liftIO . readFile |
|
78 |
>=> fromJResultE "parsing lock allocation" . J.decodeStrict |
Also available in: Unified diff