Revision b498ed42

b/src/Ganeti/JQueue.hs
48 48
    , readSerialFromDisk
49 49
    , allocateJobIds
50 50
    , allocateJobId
51
    , writeJobToDisk
51 52
    ) where
52 53

  
53 54
import Control.Concurrent.MVar
......
337 338
               liftM (\qj -> (qj, arch)) .
338 339
               fromJResult "Parsing job file" $ Text.JSON.decode str
339 340

  
341
-- | Write a job to disk.
342
writeJobToDisk :: FilePath -> QueuedJob -> IO (Result ())
343
writeJobToDisk rootdir job = do
344
  let filename = liveJobFile rootdir . qjId $ job
345
      content = Text.JSON.encode . Text.JSON.showJSON $ job
346
  tryAndLogIOError (atomicWriteFile filename content)
347
                   ("Failed to write " ++ filename) Ok
348

  
340 349
-- | Read the job serial number from disk.
341 350
readSerialFromDisk :: IO (Result JobId)
342 351
readSerialFromDisk = do

Also available in: Unified diff