distributed-process-p2p 0.1.3.2 → 0.1.4.0
raw patch · 5 files changed
+81/−39 lines, 5 filesdep ~distributed-processdep ~mtldep ~network-transport-tcpPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: distributed-process, mtl, network-transport-tcp
API changes (from Hackage documentation)
- Control.Distributed.Backend.P2P: bootstrap :: HostName -> ServiceName -> [NodeId] -> RemoteTable -> Process () -> IO ()
+ Control.Distributed.Backend.P2P: bootstrap :: HostName -> ServiceName -> (ServiceName -> (HostName, ServiceName)) -> RemoteTable -> [NodeId] -> Process () -> IO ()
- Control.Distributed.Backend.P2P: bootstrapNonBlocking :: HostName -> ServiceName -> [NodeId] -> RemoteTable -> Process () -> IO (LocalNode, ProcessId)
+ Control.Distributed.Backend.P2P: bootstrapNonBlocking :: HostName -> ServiceName -> (ServiceName -> (HostName, ServiceName)) -> RemoteTable -> [NodeId] -> Process () -> IO (LocalNode, ProcessId)
- Control.Distributed.Backend.P2P: createLocalNode :: HostName -> ServiceName -> RemoteTable -> IO LocalNode
+ Control.Distributed.Backend.P2P: createLocalNode :: HostName -> ServiceName -> (ServiceName -> (HostName, ServiceName)) -> RemoteTable -> IO LocalNode
Files
- CHANGELOG +7/−0
- LICENSE +1/−1
- distributed-process-p2p.cabal +42/−27
- src/Control/Distributed/Backend/P2P.hs +28/−10
- tests/JollyCloud.hs +3/−1
CHANGELOG view
@@ -1,3 +1,10 @@+0.1.4.0:++ * Limit network-transport-tcp to >=0.6+ * `createLocalNode` and bootsrap functions+ now require port-to-external mapper ()+ * Move `RemoteTable` argument closer to host-port-ext+ 0.1.3.2: * Drop upper bounds.
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2012, Alexander Bondarenko+Copyright (c) 2012-2016, Alexander Bondarenko All rights reserved.
distributed-process-p2p.cabal view
@@ -1,5 +1,11 @@+-- This file has been generated from package.yaml by hpack version 0.20.0.+--+-- see: https://github.com/sol/hpack+--+-- hash: a01a000a7a5b07e8ffbf1a52a25f9e247795e9751b5c8894682ed84f6eccd127+ name: distributed-process-p2p-version: 0.1.3.2+version: 0.1.4.0 synopsis: Peer-to-peer node discovery for Cloud Haskell description: Bootstraps a peer-to-peer connection network from a set of known hosts. homepage: https://bitbucket.org/dpwiz/distributed-process-p2p/@@ -10,43 +16,52 @@ copyright: Alexander Bondarenko category: Network build-type: Simple-cabal-version: >=1.8+cabal-version: >= 1.10+ extra-source-files: CHANGELOG -flag build-example- description: build "jollycloud" example which can serve as a p2p broker node.- default: False- source-repository head- type: git+ type: git location: git@bitbucket.org:dpwiz/distributed-process-p2p.git +flag build-example+ description: Build "jollycloud" example which can serve as a p2p broker node.+ manual: False+ default: False+ library- exposed-modules: Control.Distributed.Backend.P2P- -- other-modules:- hs-source-dirs: src- ghc-options: -Wall+ exposed-modules:+ Control.Distributed.Backend.P2P+ other-modules:+ Paths_distributed_process_p2p+ default-language: Haskell2010+ hs-source-dirs:+ src+ ghc-options: -Wall build-depends:- base ==4.*,- mtl >=2.1,+ base ==4.*,+ binary >=0.5, bytestring >=0.9, containers >=0.4,- binary >=0.5,- network >=2.3,-- distributed-process >=0.5,- network-transport >=0.4,- network-transport-tcp >=0.4+ distributed-process >=0.5,+ mtl >=2.1,+ network >=2.3,+ network-transport >=0.4,+ network-transport-tcp >=0.6 executable jollycloud- if !flag(build-example)- buildable: False- hs-source-dirs: tests/- main-is: JollyCloud.hs- ghc-options: -threaded+ hs-source-dirs:+ tests/+ main-is: JollyCloud.hs+ ghc-options: -threaded build-depends: base ==4.*,- mtl,- distributed-process,- distributed-process-p2p+ distributed-process >=0.5,+ distributed-process-p2p,+ mtl >=2.1+ if flag(build-example)+ buildable: True+ other-modules:+ Paths_distributed_process_p2p+ default-language: Haskell2010
src/Control/Distributed/Backend/P2P.hs view
@@ -63,16 +63,30 @@ makeNodeId addr = NodeId . EndPointAddress . BS.concat $ [BS.pack addr, ":0"] -- | Start a controller service process and aquire connections to a swarm.-bootstrap :: HostName -> ServiceName -> [NodeId] -> RemoteTable -> Process () -> IO ()-bootstrap host port seeds rTable prc = do- node <- createLocalNode host port rTable+bootstrap+ :: HostName+ -> ServiceName+ -> (ServiceName -> (HostName, ServiceName))+ -> RemoteTable+ -> [NodeId]+ -> Process ()+ -> IO ()+bootstrap host port ext rTable seeds prc = do+ node <- createLocalNode host port ext rTable _ <- forkProcess node $ peerController seeds runProcess node $ waitController prc -- | 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)-bootstrapNonBlocking host port seeds rTable prc = do- node <- createLocalNode host port rTable+bootstrapNonBlocking+ :: HostName+ -> ServiceName+ -> (ServiceName -> (HostName, ServiceName))+ -> RemoteTable+ -> [NodeId]+ -> Process ()+ -> IO (LocalNode, ProcessId)+bootstrapNonBlocking host port ext rTable seeds prc = do+ node <- createLocalNode host port ext rTable _ <- forkProcess node $ peerController seeds pid <- forkProcess node $ waitController prc return (node, pid)@@ -86,12 +100,16 @@ Just _ -> say "Bootstrap complete." >> prc -- | Creates tcp local node which used by 'bootstrap'-createLocalNode :: HostName -> ServiceName -> RemoteTable -> IO LocalNode-createLocalNode host port rTable = do+createLocalNode+ :: HostName+ -> ServiceName+ -> (ServiceName -> (HostName, ServiceName))+ -> RemoteTable+ -> IO LocalNode+createLocalNode host port mkExternal rTable = do transport <- either (error . show) id- <$> createTransport host port defaultTCPParameters+ <$> createTransport host port mkExternal defaultTCPParameters newLocalNode transport rTable- peerControllerService :: String peerControllerService = "P2P:Controller"
tests/JollyCloud.hs view
@@ -15,7 +15,9 @@ args <- getArgs case args of- host:port:seeds -> P2P.bootstrap host port (map P2P.makeNodeId seeds) initRemoteTable mainProcess+ host:port:seeds -> do+ let ext = const (host, port)+ P2P.bootstrap host port ext initRemoteTable (map P2P.makeNodeId seeds) mainProcess _ -> putStrLn "Usage: jollycloud addr port [<seed>..]" mainProcess :: Process ()