ganeti

Safe HaskellSafe-Infered

Ganeti.WConfd.Persistent

Contents

Description

Common types and functions for persistent resources

In particular: - locks - temporary reservations

Synopsis

Common definitions

The data type that collects all required operations

data Persistent a Source

A collection of operations needed for persisting a resource.

Constructors

Persistent 

Fields

persName :: String
 
persPath :: IO FilePath
 
persEmpty :: a
 
persCleanup :: ClientId -> WConfdMonad ()

The clean-up action needs to be a full WConfdMonad action as it might need to do some complex processing, such as notifying clients that some locks are available.

Common functions

writePersistentAsyncTask :: JSON a => Persistent a -> IO a -> ResultG (AsyncWorker () ())Source

Construct an asynchronous worker whose action is to save the current state of the persistent state. The worker's action reads the state using the given IO action. Any inbetween changes to the file are tacitly ignored.

readPersistent :: JSON a => Persistent a -> ResultG aSource

Load a persistent data structure from disk.

Implementations

Locks

Temporary reservations