-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Peer-to-peer node discovery for Cloud Haskell -- @package distributed-process-p2p @version 0.1.3.2 -- | Peer-to-peer node discovery backend for Cloud Haskell based on the TCP -- transport. Provided with a known node address it discovers and -- maintains the knowledge of it's peers. -- --
--   import qualified Control.Distributed.Backend.P2P as P2P
--   import           Control.Monad.Trans (liftIO)
--   import           Control.Concurrent (threadDelay)
--   
--   main = P2P.bootstrap "myhostname" "9001" [P2P.makeNodeId "seedhost:9000"] $ do
--       liftIO $ threadDelay 1000000 -- give dispatcher a second to discover other nodes
--       P2P.nsendPeers "myService" ("some", "message")
--   
module Control.Distributed.Backend.P2P -- | Start a controller service process and aquire connections to a swarm. bootstrap :: HostName -> ServiceName -> [NodeId] -> RemoteTable -> Process () -> IO () -- | Like bootstrap but use forkProcess instead of -- runProcess. Returns local node and pid of given process bootstrapNonBlocking :: HostName -> ServiceName -> [NodeId] -> RemoteTable -> Process () -> IO (LocalNode, ProcessId) -- | A P2P controller service process. peerController :: [NodeId] -> Process () -- | Make a NodeId from "host:port" string. makeNodeId :: String -> NodeId -- | Get a list of currently available peer nodes. getPeers :: Process [NodeId] -- | Poll a network for a list of specific service providers. getCapable :: String -> Process [ProcessId] -- | Broadcast a message to a specific service on all peers. nsendPeers :: Serializable a => String -> a -> Process () -- | Broadcast a message to a service of on nodes currently running it. nsendCapable :: Serializable a => String -> a -> Process () -- | Creates tcp local node which used by bootstrap createLocalNode :: HostName -> ServiceName -> RemoteTable -> IO LocalNode -- | Waits for controller to start, then runs given process waitController :: Process a -> Process a