gargoyle-0.1.1.0: Automatically spin up and spin down local daemons

Gargoyle

Description

Utilities for running a daemon in a local directory

Synopsis

# Documentation

data Gargoyle pid a Source #

Constructors

 Gargoyle Fields_gargoyle_exec :: FilePathThe path to the executable created with gargoyleMain which will serve as the daemon monitor process._gargoyle_init :: FilePath -> IO ()The action to run in order to populate the daemon's environment for the first run._gargoyle_start :: FilePath -> IO pidThe action to run in order to spin up the daemon on every run. This happens after _gargoyle_init if it also runs._gargoyle_stop :: pid -> IO ()The action to run when the monitor process detects that no clients are connected anymore._gargoyle_getInfo :: FilePath -> IO aRun a command which knows about the working directory of the daemon to collect runtime information to pass to client code in withGargoyle.

Arguments

 :: Gargoyle pid a Description of how to manage the daemon. -> FilePath The directory where the daemon should be initialized. -> (a -> IO b) Client action which has access to runtime information provided by the Gargoyle. -> IO b By the time this function returns, the monitor process is aware that the the client is no longer interested in the daemon.

Run an IO action while maintaining a connection to a daemon. The daemon will automatically be stopped when no clients remain. If the daemon has not yet been initialized, it will be. The counterpart of this function is gargoyleMain which should be used to produce an executable that will monitor the daemon's status.

Arguments

 :: Gargoyle pid a Description of how to initialize, spin up, and spin down a daemon. -> IO () Returns only when all clients have disconnected.

Run a local daemon over a domain socket; the daemon will be automatically stopped when no clients remain. This function assumes that the daemon has already been initialized in the specified location. This function should be used as the main function of an executable which will then be invoked by calling withGargoyle in the client code to monitor the daemon's status.