Revision 966ea086 src/Ganeti/Types.hs

b/src/Ganeti/Types.hs
110 110
  , RelativeJobId
111 111
  , JobIdDep(..)
112 112
  , JobDependency(..)
113
  , absoluteJobDependency
113 114
  , OpSubmitPriority(..)
114 115
  , opSubmitPriorityToRaw
115 116
  , parseSubmitPriority
......
675 676
      JSON.Ok r -> return $ JobDepRelative r
676 677
      JSON.Error _ -> liftM JobDepAbsolute (parseJobId v)
677 678

  
679
-- | From job ID dependency and job ID, compute the absolute dependency.
680
absoluteJobIdDep :: (Monad m) => JobIdDep -> JobId -> m JobIdDep
681
absoluteJobIdDep (JobDepAbsolute jid) _ = return $ JobDepAbsolute jid
682
absoluteJobIdDep (JobDepRelative rjid) jid =
683
  liftM JobDepAbsolute . makeJobId $ fromJobId jid + fromNegative rjid 
684

  
678 685
-- | Job Dependency type.
679 686
data JobDependency = JobDependency JobIdDep [FinalizedJobStatus]
680 687
                     deriving (Show, Eq)
......
683 690
  showJSON (JobDependency dep status) = showJSON (dep, status)
684 691
  readJSON = liftM (uncurry JobDependency) . readJSON
685 692

  
693
-- | From job dependency and job id compute an absolute job dependency.
694
absoluteJobDependency :: (Monad m) => JobDependency -> JobId -> m JobDependency
695
absoluteJobDependency (JobDependency jdep fstats) jid =
696
  liftM (flip JobDependency fstats) $ absoluteJobIdDep jdep jid 
697

  
686 698
-- | Valid opcode priorities for submit.
687 699
$(THH.declareIADT "OpSubmitPriority"
688 700
  [ ("OpPrioLow",    'ConstantUtils.priorityLow)

Also available in: Unified diff