Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Ganeti.Daemon
Description
Implementation of the generic daemon functionality.
Synopsis
- data DaemonOptions = DaemonOptions {
- optShowHelp :: Bool
- optShowVer :: Bool
- optShowComp :: Bool
- optDaemonize :: Bool
- optPort :: Maybe Word16
- optDebug :: Bool
- optNoUserChecks :: Bool
- optBindAddress :: Maybe String
- optSyslogUsage :: Maybe SyslogUsage
- optForceNode :: Bool
- optNoVoting :: Bool
- optYesDoIt :: Bool
- type OptType = GenericOptType DaemonOptions
- type CheckFn a = DaemonOptions -> IO (Either ExitCode a)
- type PrepFn a b = DaemonOptions -> a -> IO b
- type MainFn a b = DaemonOptions -> a -> b -> IO ()
- defaultOptions :: DaemonOptions
- oShowHelp :: StandardOptions a => GenericOptType a
- oShowVer :: StandardOptions a => GenericOptType a
- oNoDaemonize :: OptType
- oNoUserChecks :: OptType
- oDebug :: OptType
- oPort :: Int -> OptType
- oBindAddress :: OptType
- oSyslogUsage :: OptType
- oForceNode :: OptType
- oNoVoting :: OptType
- oYesDoIt :: OptType
- parseArgs :: String -> [OptType] -> IO (DaemonOptions, [String])
- parseAddress :: DaemonOptions -> Int -> IO (Result (Family, SockAddr))
- cleanupSocket :: FilePath -> IO ()
- describeError :: String -> Maybe Handle -> Maybe FilePath -> IO a -> IO a
- genericMain :: GanetiDaemon -> [OptType] -> CheckFn a -> PrepFn a b -> MainFn a b -> IO ()
- getFQDN :: IO String
Documentation
data DaemonOptions #
Command line options structure.
Constructors
DaemonOptions | |
Fields
|
Instances
StandardOptions DaemonOptions # | |
Defined in Ganeti.Daemon Methods helpRequested :: DaemonOptions -> Bool # verRequested :: DaemonOptions -> Bool # compRequested :: DaemonOptions -> Bool # requestHelp :: DaemonOptions -> DaemonOptions # |
type OptType = GenericOptType DaemonOptions #
Abrreviation for the option type.
type CheckFn a = DaemonOptions -> IO (Either ExitCode a) #
Check function type.
type PrepFn a b = DaemonOptions -> a -> IO b #
Prepare function type.
type MainFn a b = DaemonOptions -> a -> b -> IO () #
Main execution function type.
defaultOptions :: DaemonOptions #
Default values for the command line options.
oShowHelp :: StandardOptions a => GenericOptType a #
Option to request help output.
oShowVer :: StandardOptions a => GenericOptType a #
Option to request version information.
oNoDaemonize :: OptType #
oBindAddress :: OptType #
oSyslogUsage :: OptType #
oForceNode :: OptType #
parseArgs :: String -> [OptType] -> IO (DaemonOptions, [String]) #
Small wrapper over getArgs and parseOpts
.
Arguments
:: DaemonOptions | Command line options |
-> Int | Default port for this daemon |
-> IO (Result (Family, SockAddr)) |
Based on the options, compute the socket address to use for the daemon.
cleanupSocket :: FilePath -> IO () #
Helper function to ensure a socket doesn't exist. Should only be called once we have locked the pid file successfully.
describeError :: String -> Maybe Handle -> Maybe FilePath -> IO a -> IO a #
Run an I/O action that might throw an I/O error, under a handler that will simply annotate and re-throw the exception.
Arguments
:: GanetiDaemon | The daemon we're running |
-> [OptType] | The available options |
-> CheckFn a | Check function |
-> PrepFn a b | Prepare function |
-> MainFn a b | Execution function |
-> IO () |
Generic daemon startup.