On Thu, Nov 7, 2013 at 1:20 PM, Klaus Aehlig <[email protected]> wrote:
> This methods allows reading the maximal job serial number from
> disk.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  src/Ganeti/JQueue.hs | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/Ganeti/JQueue.hs b/src/Ganeti/JQueue.hs
> index 991cfa0..61731d5 100644
> --- a/src/Ganeti/JQueue.hs
> +++ b/src/Ganeti/JQueue.hs
> @@ -45,6 +45,7 @@ module Ganeti.JQueue
>      , sortJobIDs
>      , loadJobFromDisk
>      , noSuchJob
> +    , readSerialFromDisk
>      ) where
>
>  import Control.Exception
> @@ -69,6 +70,7 @@ import Ganeti.OpCodes
>  import Ganeti.Path
>  import Ganeti.THH
>  import Ganeti.Types
> +import Ganeti.Utils
>
>  -- * Data types
>
> @@ -329,3 +331,10 @@ loadJobFromDisk rootdir archived jid = do
>               Just (str, arch) ->
>                 liftM (\qj -> (qj, arch)) .
>                 fromJResult "Parsing job file" $ Text.JSON.decode str
> +
> +-- | Read the job serial number from disk.
> +readSerialFromDisk :: IO (Result JobId)
> +readSerialFromDisk = do
> +  filename <- jobQueueSerialFile
> +  tryAndLogIOError (readFile filename) "Failed to read serial file"
> +                   (makeJobIdS . rStripSpace)
> --
> 1.8.4.1
>

I guess the title of the patch should be "Provide method *to* read job
serial number".

Rest LGTM, thanks.

Michele

-- 
Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to