remote-0.1: Cloud Haskell



Exposes a high-level interface for starting a node of a distributed program, taking into account a local configuration file, command line arguments, and commonly-used system processes.



remoteInit :: Maybe FilePath -> [RemoteCallMetaData] -> (String -> ProcessM ()) -> IO ()Source

This is the usual way create a single node of distributed program. The intent is that remoteInit be called in your program's Main.main function. A typical call takes this form:

 main = remoteInit (Just "config") [Main.__remoteCallMetaData] initialProcess

This will:

  1. Read the configuration file config in the current directory or, if specified, from the file whose path is given by the environment variable RH_CONFIG. If the given file does not exist or is invalid, an exception will be thrown.
  2. Use the configuration given in the file as well as on the command-line to create a new node. The usual system processes will be started, including logging, discovery, and spawning.
  3. Compile-time metadata, generated by Remote.Call.remotable, will used for invoking closures. Metadata from each module must be explicitly mentioned.
  4. The function initialProcess will be called, given as a parameter a string indicating the value of the cfgRole setting of this node. initialProcess is provided by the user and provides an entrypoint for controlling node behavior on startup.