Safe Haskell | None |
---|
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")
Documentation
bootstrap :: String -> String -> [NodeId] -> Process () -> IO ()Source
Start a peerController process and aquire connections to a swarm.
makeNodeId :: String -> NodeIdSource
Make a NodeId from host:port string.
nsendPeers :: Serializable a => String -> a -> Process ()Source
Broadcast a message to a specific service on all peers.