ganeti

Safe HaskellSafe-Infered

Ganeti.WConfd.ConfigWriter

Contents

Description

Implementation of functions specific to configuration management.

Synopsis

Documentation

loadConfigFromFile :: FilePath -> ResultG (ConfigData, FStat)Source

Loads the configuration from the file, if it hasn't been loaded yet. The function is internal and isn't thread safe.

writeConfigToFile :: (MonadBase IO m, MonadError GanetiException m, MonadLog m) => ConfigData -> FilePath -> FStat -> m FStatSource

Asynchronous tasks

finishOrLog :: (Show e, MonadLog m) => Priority -> String -> (a -> m ()) -> GenericResult e a -> m ()Source

mkStatelessAsyncTask :: (MonadBaseControl IO m, MonadLog m, Show e, Monoid i) => Priority -> String -> (i -> ResultT e m ()) -> m (AsyncWorker i ())Source

mkStatefulAsyncTask :: (MonadBaseControl IO m, MonadLog m, Show e, Monoid i) => Priority -> String -> s -> (s -> i -> ResultT e m s) -> m (AsyncWorker i ())Source

saveConfigAsyncTaskSource

Arguments

:: FilePath

Path to the config file

-> FStat

The initial state of the config. file

-> IO ConfigState

An action to read the current config

-> [AsyncWorker DistributionTarget ()]

Workers to be triggered afterwards

-> ResultG (AsyncWorker (Any, DistributionTarget) ()) 

Construct an asynchronous worker whose action is to save the configuration to the master file. The worker's action reads the configuration using the given IO action and uses FStat to check if the configuration hasn't been modified by another process.

If Any of the input requests is true, given additional worker will be executed synchronously after sucessfully writing the configuration file. Otherwise, they'll be just triggered asynchronously.

execRpcCallAndLog :: Rpc a b => [Node] -> a -> ResultG ()Source

distMCsAsyncTaskSource

Arguments

:: RuntimeEnts 
-> FilePath

Path to the config file

-> IO ConfigState

An action to read the current config

-> ResultG (AsyncWorker DistributionTarget ()) 

Construct an asynchronous worker whose action is to distribute the configuration to master candidates.

distSSConfAsyncTaskSource

Arguments

:: IO ConfigState

An action to read the current config

-> ResultG (AsyncWorker DistributionTarget ()) 

Construct an asynchronous worker whose action is to construct SSConf and distribute it to master candidates. The worker's action reads the configuration using the given IO action, computes the current SSConf, compares it to the previous version, and if different, distributes it.