ganeti-3.1: Cluster-based virtualization management software
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ganeti.WConfd.Monad

Description

All RPC calls are run within this monad.

It encapsulates:

  • IO operations,
  • failures,
  • working with the daemon state.

Code that is specific either to the configuration or the lock management, should go into their corresponding dedicated modules.

Synopsis

Documentation

dhConfigPath :: DaemonHandle -> FilePath #

The configuration file path all static information that doesn't change during the life-time of the daemon should go here; all IDs of threads that do asynchronous work should probably also go here

mkDaemonHandle #

Arguments

:: FilePath 
-> ConfigState 
-> GanetiLockWaiting 
-> TempResState 
-> (IO ConfigState -> [AsyncWorker DistributionTarget ()] -> ResultG (AsyncWorker (Any, DistributionTarget) ()))

A function that creates a worker that asynchronously saves the configuration to the master file.

-> (IO ConfigState -> ResultG (AsyncWorker DistributionTarget ()))

A function that creates a worker that asynchronously distributes the configuration to master candidates

-> (IO ConfigState -> ResultG (AsyncWorker DistributionTarget ()))

A function that creates a worker that asynchronously distributes SSConf to nodes

-> (IO GanetiLockWaiting -> ResultG (AsyncWorker () ()))

A function that creates a worker that asynchronously saves the lock allocation state.

-> (IO TempResState -> ResultG (AsyncWorker () ()))

A function that creates a worker that asynchronously saves the temporary reservations state.

-> Livelock 
-> ResultG DaemonHandle 

data WConfdMonadInt a #

The internal part of the monad without error handling.

Instances

Instances details
MonadIO WConfdMonadInt # 
Instance details

Defined in Ganeti.WConfd.Monad

Methods

liftIO :: IO a -> WConfdMonadInt a #

Applicative WConfdMonadInt # 
Instance details

Defined in Ganeti.WConfd.Monad

Functor WConfdMonadInt # 
Instance details

Defined in Ganeti.WConfd.Monad

Methods

fmap :: (a -> b) -> WConfdMonadInt a -> WConfdMonadInt b

(<$) :: a -> WConfdMonadInt b -> WConfdMonadInt a

Monad WConfdMonadInt # 
Instance details

Defined in Ganeti.WConfd.Monad

MonadLog WConfdMonadInt # 
Instance details

Defined in Ganeti.WConfd.Monad

Methods

logAt :: Priority -> String -> WConfdMonadInt () #

MonadBaseControl IO WConfdMonadInt # 
Instance details

Defined in Ganeti.WConfd.Monad

Associated Types

type StM WConfdMonadInt a

Methods

liftBaseWith :: (RunInBase WConfdMonadInt IO -> IO a) -> WConfdMonadInt a

restoreM :: StM WConfdMonadInt a -> WConfdMonadInt a

MonadBase IO WConfdMonadInt # 
Instance details

Defined in Ganeti.WConfd.Monad

Methods

liftBase :: IO α -> WConfdMonadInt α

type StM WConfdMonadInt b # 
Instance details

Defined in Ganeti.WConfd.Monad

type StM WConfdMonadInt b

runWConfdMonadInt :: WConfdMonadInt a -> DaemonHandle -> IO a #

Runs the internal part of the WConfdMonad monad on a given daemon handle.

type WConfdMonad = ResultT GanetiException WConfdMonadInt #

The complete monad with error handling.

daemonHandle :: WConfdMonad DaemonHandle #

Returns the daemon handle.

modifyConfigState :: (ConfigState -> (a, ConfigState)) -> WConfdMonad a #

Atomically modifies the configuration state in the WConfdMonad.

modifyConfigStateWithImmediate :: (ConfigState -> (a, ConfigState)) -> WConfdMonad () -> WConfdMonad a #

Atomically modifies the configuration state in WConfdMonad; immediately afterwards (while the config write-out is not necessarily finished) do another acation.

forceConfigStateDistribution :: DistributionTarget -> WConfdMonad () #

Force the distribution of configuration without actually modifying it.

We need a separate call for this operation, because modifyConfigState only triggers the distribution when the configuration changes.

readConfigState :: WConfdMonad ConfigState #

Returns the current configuration, given a handle

modifyConfigDataErr_ :: (TempResState -> ConfigData -> AtomicModifyMonad ConfigData) -> WConfdMonad () #

Atomically modifies the configuration data in the WConfdMonad with a computation that can possibly fail.

modifyConfigAndReturnWithLock :: (TempResState -> ConfigState -> AtomicModifyMonad (a, ConfigState)) -> State TempResState () -> WConfdMonad (Maybe a) #

Modify the configuration while temporarily acquiring the configuration lock. If the configuration lock is held by someone else, nothing is changed and Nothing is returned.

modifyConfigWithLock :: (TempResState -> ConfigState -> AtomicModifyMonad ConfigState) -> State TempResState () -> WConfdMonad (Maybe ()) #

modifyLockWaiting :: (GanetiLockWaiting -> (GanetiLockWaiting, (a, Set ClientId))) -> WConfdMonad a #

Atomically modifies the lock waiting state in WConfdMonad.

modifyLockWaiting_ :: (GanetiLockWaiting -> (GanetiLockWaiting, Set ClientId)) -> WConfdMonad () #

Atomically modifies the lock allocation state in WConfdMonad, not producing any result

readLockWaiting :: WConfdMonad GanetiLockWaiting #

Read the lock waiting state in WConfdMonad.

readLockAllocation :: WConfdMonad (LockAllocation GanetiLocks ClientId) #

Read the underlying lock allocation.

modifyTempResState :: (ConfigData -> State TempResState a) -> WConfdMonad a #

Atomically modifies the state of temporary reservations in WConfdMonad.

modifyTempResStateErr :: (ConfigData -> StateT TempResState ErrorResult a) -> WConfdMonad a #

Atomically modifies the state of temporary reservations in WConfdMonad in the presence of possible errors.

readTempResState :: WConfdMonad (ConfigData, TempResState) #

Reads the state of of the configuration and temporary reservations in WConfdMonad.

data DistributionTarget #

Data type describing where the configuration has to be distributed to.

Constructors

Everywhere 
ToGroups (Set String)