-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Simple zero-configuration backend for Cloud Haskell -- -- Simple backend based on the TCP transport which offers node discovery -- based on UDP multicast. This is a zero-configuration backend designed -- to get you going with Cloud Haskell quickly without imposing any -- structure on your application. @package distributed-process-simplelocalnet @version 0.2.0 -- | Multicast utilities module Control.Distributed.Process.Backend.SimpleLocalnet.Internal.Multicast -- | Given a hostname and a port number, initialize the multicast system. -- -- Note: it is important that you never send messages larger than the -- maximum message size; if you do, all subsequent communication will -- probably fail. -- -- Returns a reader and a writer. -- -- NOTE: By rights the two functions should be locally polymorphic -- in a, but this requires impredicative types. initMulticast :: Binary a => HostName -> PortNumber -> Int -> IO (IO (a, SockAddr), a -> IO ()) instance Ord SockAddr -- | Simple backend based on the TCP transport which offers node discovery -- based on UDP multicast. This is a zero-configuration backend designed -- to get you going with Cloud Haskell quickly without imposing any -- structure on your application. -- -- To simplify getting started we provide special support for -- master and slave nodes (see startSlave and -- startMaster). Use of these functions is completely optional; -- you can use the local backend without making use of the predefined -- master and slave nodes. -- -- -- --
--   import System.Environment (getArgs)
--   import Control.Distributed.Process
--   import Control.Distributed.Process.Node (initRemoteTable)
--   import Control.Distributed.Process.Backend.Local 
--   
--   master :: Backend -> [NodeId] -> Process ()
--   master backend slaves = do
--     -- Do something interesting with the slaves
--     liftIO . putStrLn $ "Slaves: " ++ show slaves
--     -- Terminate the slaves when the master terminates (this is optional)
--     terminateAllSlaves backend
--   
--   main :: IO ()
--   main = do
--     args <- getArgs
--   
--     case args of
--       ["master", host, port] -> do
--         backend <- initializeBackend host port initRemoteTable 
--         startMaster backend (master backend)
--       ["slave", host, port] -> do
--         backend <- initializeBackend host port initRemoteTable 
--         startSlave backend
--   
module Control.Distributed.Process.Backend.SimpleLocalnet -- | Local backend data Backend Backend :: IO LocalNode -> (Int -> IO [NodeId]) -> Process () -> Backend -- | Create a new local node newLocalNode :: Backend -> IO LocalNode -- | findPeers t sends out a who's there? request, waits -- t msec, and then collects and returns the answers findPeers :: Backend -> Int -> IO [NodeId] -- | Make sure that all log messages are printed by the logger on the -- current node redirectLogsHere :: Backend -> Process () -- | Initialize the backend initializeBackend :: HostName -> ServiceName -> RemoteTable -> IO Backend -- | Calling slave sets up a new local node and then waits. You -- start processes on the slave by calling spawn from other -- nodes. -- -- This function does not return. The only way to exit the slave is to -- CTRL-C the process or call terminateSlave from another node. startSlave :: Backend -> IO () -- | Terminate the slave at the given node ID terminateSlave :: NodeId -> Process () -- | Find slave nodes findSlaves :: Backend -> Process [NodeId] -- | Terminate all slaves terminateAllSlaves :: Backend -> Process () -- | startMaster finds all slaves currently available on the local -- network (which should therefore be started first), redirects all log -- messages to itself, and then calls the specified process, passing the -- list of slaves nodes. -- -- Terminates when the specified process terminates. If you want to -- terminate the slaves when the master terminates, you should manually -- call terminateAllSlaves. startMaster :: Backend -> ([NodeId] -> Process ()) -> IO () instance Typeable SlaveControllerMsg instance Show SlaveControllerMsg instance Binary SlaveControllerMsg instance Binary PeerDiscoveryMsg