On Fri, Jul 04, 2014 at 01:17:57PM +0200, 'Petr Pudlak' via ganeti-devel wrote:
> Currently, the part that loads/saves locks is generic, with no lock
> specifics. Abstract it so that it can be reused for temporary
> reservations.
> 
> Signed-off-by: Petr Pudlak <[email protected]>
> ---
>  Makefile.am                         |   1 +
>  src/Ganeti/Locking/Locks.hs         |  41 +------------
>  src/Ganeti/WConfd/DeathDetection.hs |   4 +-
>  src/Ganeti/WConfd/Persistent.hs     | 114 
> ++++++++++++++++++++++++++++++++++++
>  src/Ganeti/WConfd/Server.hs         |  18 ++----
>  5 files changed, 123 insertions(+), 55 deletions(-)
>  create mode 100644 src/Ganeti/WConfd/Persistent.hs


> +-- | Load a persistent data structure from disk.
> +readPersistent :: (J.JSON a) => Persistent a -> ResultG a
> +readPersistent pers = do
> +  logDebug $ "Reading " ++ persName pers
> +  file <- liftIO $ persPath pers
> +  file_present <- liftIO $ doesFileExist file
> +  if file_present
> +    then
> +      liftIO (persPath pers >>= readFile)
> +        >>= J.fromJResultE ("parsing " ++ persName pers) . J.decodeStrict
> +    else do
> +      logInfo $ "Note: No saved data for " ++ persName pers
> +                ++ ", silently assuming empty."

s/silently/tacitly

> +      return (persEmpty pers)


Rest LGTM. No need to resend.

-- 
Klaus Aehlig
Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores

Reply via email to