root / src / Ganeti / Query / Locks.hs @ 86b04819
History | View | Annotate | Download (1.8 kB)
1 | 86b04819 | Klaus Aehlig | {-| Implementation of Ganeti Lock field queries |
---|---|---|---|
2 | 86b04819 | Klaus Aehlig | |
3 | 86b04819 | Klaus Aehlig | The actual computation of the field values is done by forwarding |
4 | 86b04819 | Klaus Aehlig | the request; so only have a minimal field definition here. |
5 | 86b04819 | Klaus Aehlig | |
6 | 86b04819 | Klaus Aehlig | -} |
7 | 86b04819 | Klaus Aehlig | |
8 | 86b04819 | Klaus Aehlig | {- |
9 | 86b04819 | Klaus Aehlig | |
10 | 86b04819 | Klaus Aehlig | Copyright (C) 2014 Google Inc. |
11 | 86b04819 | Klaus Aehlig | |
12 | 86b04819 | Klaus Aehlig | This program is free software; you can redistribute it and/or modify |
13 | 86b04819 | Klaus Aehlig | it under the terms of the GNU General Public License as published by |
14 | 86b04819 | Klaus Aehlig | the Free Software Foundation; either version 2 of the License, or |
15 | 86b04819 | Klaus Aehlig | (at your option) any later version. |
16 | 86b04819 | Klaus Aehlig | |
17 | 86b04819 | Klaus Aehlig | This program is distributed in the hope that it will be useful, but |
18 | 86b04819 | Klaus Aehlig | WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | 86b04819 | Klaus Aehlig | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
20 | 86b04819 | Klaus Aehlig | General Public License for more details. |
21 | 86b04819 | Klaus Aehlig | |
22 | 86b04819 | Klaus Aehlig | You should have received a copy of the GNU General Public License |
23 | 86b04819 | Klaus Aehlig | along with this program; if not, write to the Free Software |
24 | 86b04819 | Klaus Aehlig | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
25 | 86b04819 | Klaus Aehlig | 02110-1301, USA. |
26 | 86b04819 | Klaus Aehlig | |
27 | 86b04819 | Klaus Aehlig | -} |
28 | 86b04819 | Klaus Aehlig | |
29 | 86b04819 | Klaus Aehlig | module Ganeti.Query.Locks |
30 | 86b04819 | Klaus Aehlig | ( fieldsMap |
31 | 86b04819 | Klaus Aehlig | ) where |
32 | 86b04819 | Klaus Aehlig | |
33 | 86b04819 | Klaus Aehlig | import qualified Data.Map as Map |
34 | 86b04819 | Klaus Aehlig | |
35 | 86b04819 | Klaus Aehlig | import Ganeti.Query.Common |
36 | 86b04819 | Klaus Aehlig | import Ganeti.Query.Language |
37 | 86b04819 | Klaus Aehlig | import Ganeti.Query.Types |
38 | 86b04819 | Klaus Aehlig | |
39 | 86b04819 | Klaus Aehlig | -- | List of all lock fields. |
40 | 86b04819 | Klaus Aehlig | lockFields :: FieldList String () |
41 | 86b04819 | Klaus Aehlig | lockFields = |
42 | 86b04819 | Klaus Aehlig | [ (FieldDefinition "name" "Name" QFTOther "Lock name", |
43 | 86b04819 | Klaus Aehlig | FieldSimple rsNormal, QffNormal) |
44 | 86b04819 | Klaus Aehlig | , (FieldDefinition "mode" "Mode" QFTOther "Mode in which the lock is\ |
45 | 86b04819 | Klaus Aehlig | \ currently acquired\ |
46 | 86b04819 | Klaus Aehlig | \ (exclusive or shared)", |
47 | 86b04819 | Klaus Aehlig | FieldSimple rsNormal, QffNormal) |
48 | 86b04819 | Klaus Aehlig | , (FieldDefinition "owner" "Owner" QFTOther "Current lock owner(s)", |
49 | 86b04819 | Klaus Aehlig | FieldSimple rsNormal, QffNormal) |
50 | 86b04819 | Klaus Aehlig | , (FieldDefinition "pending" "Pending" QFTOther "Jobs waiting for the lock", |
51 | 86b04819 | Klaus Aehlig | FieldSimple rsNormal, QffNormal) |
52 | 86b04819 | Klaus Aehlig | ] |
53 | 86b04819 | Klaus Aehlig | |
54 | 86b04819 | Klaus Aehlig | -- | The lock fields map. |
55 | 86b04819 | Klaus Aehlig | fieldsMap :: FieldMap String () |
56 | 86b04819 | Klaus Aehlig | fieldsMap = |
57 | 86b04819 | Klaus Aehlig | Map.fromList $ map (\v@(f, _, _) -> (fdefName f, v)) lockFields |