LGTM, thanks. (Just a small idea: It seems that
Map.fromList $ map (\v@(f, _, _) -> (fdefName f, v)) ... is duplicated in several files, perhaps it's be worth making this expression a named function. No need to resend.) On Tue, Jan 21, 2014 at 2:41 PM, Klaus Aehlig <[email protected]> wrote: > For luxid to be feature-complete with respect to masterd, it > also needs to answer requests about locks. This includes knowing > the fields available for locks. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > Makefile.am | 1 + > src/Ganeti/Query/Locks.hs | 57 > +++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 58 insertions(+) > create mode 100644 src/Ganeti/Query/Locks.hs > > diff --git a/Makefile.am b/Makefile.am > index 0e3216f..1f0a745 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -726,6 +726,7 @@ HS_LIB_SRCS = \ > src/Ganeti/Query/Instance.hs \ > src/Ganeti/Query/Job.hs \ > src/Ganeti/Query/Language.hs \ > + src/Ganeti/Query/Locks.hs \ > src/Ganeti/Query/Network.hs \ > src/Ganeti/Query/Node.hs \ > src/Ganeti/Query/Query.hs \ > diff --git a/src/Ganeti/Query/Locks.hs b/src/Ganeti/Query/Locks.hs > new file mode 100644 > index 0000000..363f539 > --- /dev/null > +++ b/src/Ganeti/Query/Locks.hs > @@ -0,0 +1,57 @@ > +{-| Implementation of Ganeti Lock field queries > + > +The actual computation of the field values is done by forwarding > +the request; so only have a minimal field definition here. > + > +-} > + > +{- > + > +Copyright (C) 2014 Google Inc. > + > +This program is free software; you can redistribute it and/or modify > +it under the terms of the GNU General Public License as published by > +the Free Software Foundation; either version 2 of the License, or > +(at your option) any later version. > + > +This program is distributed in the hope that it will be useful, but > +WITHOUT ANY WARRANTY; without even the implied warranty of > +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > +General Public License for more details. > + > +You should have received a copy of the GNU General Public License > +along with this program; if not, write to the Free Software > +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > +02110-1301, USA. > + > +-} > + > +module Ganeti.Query.Locks > + ( fieldsMap > + ) where > + > +import qualified Data.Map as Map > + > +import Ganeti.Query.Common > +import Ganeti.Query.Language > +import Ganeti.Query.Types > + > +-- | List of all lock fields. > +lockFields :: FieldList String () > +lockFields = > + [ (FieldDefinition "name" "Name" QFTOther "Lock name", > + FieldSimple rsNormal, QffNormal) > + , (FieldDefinition "mode" "Mode" QFTOther "Mode in which the lock is\ > + \ currently acquired\ > + \ (exclusive or shared)", > + FieldSimple rsNormal, QffNormal) > + , (FieldDefinition "owner" "Owner" QFTOther "Current lock owner(s)", > + FieldSimple rsNormal, QffNormal) > + , (FieldDefinition "pending" "Pending" QFTOther "Jobs waiting for the > lock", > + FieldSimple rsNormal, QffNormal) > + ] > + > +-- | The lock fields map. > +fieldsMap :: FieldMap String () > +fieldsMap = > + Map.fromList $ map (\v@(f, _, _) -> (fdefName f, v)) lockFields > -- > 1.8.5.3 > >
