raketka 1.1.1 → 1.1.2
raw patch · 9 files changed
+63/−35 lines, 9 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Control.Distributed.Raketka.Type.Server: instance Control.Distributed.Raketka.Type.Server.PeerInfo (Data.Set.Base.Set Control.Distributed.Process.Internal.Types.ProcessId)
+ Control.Distributed.Raketka.NodeId: encodeEndPointAddress :: HostName -> ServiceName -> EndPointId -> EndPointAddress
+ Control.Distributed.Raketka.Type.Server: instance Control.Distributed.Raketka.Type.Server.PeerInfo (Data.Set.Internal.Set Control.Distributed.Process.Internal.Types.ProcessId)
Files
- README.md +0/−10
- changelog.md +4/−0
- raketka.cabal +16/−7
- src/Control/Distributed/Raketka/Impl/Inst.hs +12/−5
- src/Control/Distributed/Raketka/NodeId.hs +12/−1
- src/Main.hs +12/−5
- test-conf.json +3/−3
- test/Main.hs +0/−4
- test/TestMain.hs +4/−0
README.md view
@@ -1,13 +1,4 @@ ### raketka-- note : package build may fail -- due to version clash between aeson, vector, primitive packages- - https://github.com/ciez/vector is a patched version of vector-0.11.0.0--- * basic distributed-process node * configurable peers @@ -40,4 +31,3 @@ 1. path to config.json (see test-conf.json) 2. idx of this node in the cluster: 0 .. (length Cluster -1) -
changelog.md view
@@ -1,3 +1,7 @@+##### 1.1.2+ fix broken build. Reason: API change in dependency network-transport-tcp+ split Main to 2 funs + ##### 1.1.1 change common state from TVar s to s
raketka.cabal view
@@ -1,8 +1,8 @@ name: raketka-version: 1.1.1+version: 1.1.2 build-type: Simple-synopsis: basic distributed-process node with configurable peers-description: start multiple nodes, let them communicate. +synopsis: distributed-process node+description: peer node with simplelocalnet backend author: Imants Cekusins maintainer: Imants Cekusins@@ -32,8 +32,9 @@ ghc-options: -fwarn-unused-imports build-depends: base >=4.8 && <5.0,- binary, - containers, + binary,+ bytestring,+ containers, stm, distributed-process, distributed-process-simplelocalnet,@@ -73,6 +74,15 @@ main-is: Main.hs ghc-options: -fwarn-unused-imports other-modules: Control.Distributed.Raketka.Impl.Inst+ Control.Distributed.Raketka.HandleMsg+ Control.Distributed.Raketka.Master+ Control.Distributed.Raketka.NewServerInfo+ Control.Distributed.Raketka.NodeId+ Control.Distributed.Raketka.Process.Send+ Control.Distributed.Raketka.Process.Server+ Control.Distributed.Raketka.Type.Arg+ Control.Distributed.Raketka.Type.Message+ Control.Distributed.Raketka.Type.Server build-depends: base >=4.8 && <5.0, binary,@@ -130,8 +140,7 @@ TemplateHaskell ConstraintKinds -- main-is: Main.hs+ main-is: TestMain.hs build-depends: base >= 4.8, hspec >= 2.1.7,
src/Control/Distributed/Raketka/Impl/Inst.hs view
@@ -26,12 +26,19 @@ startServer (Tagged id0) _ = server id0 onPeerConnected::Tagged Slb Server_slb -> ProcessId -> Process ()- onPeerConnected (Tagged s0) pid0 =- say $ printf "connected to %s" pid0- + onPeerConnected (Tagged s0) = tracePid "connected to %s"+ onPeerDisConnected::Tagged Slb Server_slb -> ProcessId -> Process ()- onPeerDisConnected (Tagged s0) pid0 =- say $ printf "disconnected %s" pid0+ onPeerDisConnected (Tagged s0) = tracePid "disconnected %s"+++tracePid::String -- ^ formattable string with a placeholder for pid+ -> ProcessId+ -> Process ()+tracePid msg0 pid0 =+ trace msg1 $+ pure ()+ where msg1 = printf msg0 pid0 server::ServerId -> Process ()
src/Control/Distributed/Raketka/NodeId.hs view
@@ -3,10 +3,21 @@ import Control.Distributed.Process import Network.Transport.TCP import Control.Distributed.Raketka.Type.Arg+import Network.Transport ( EndPointAddress(..) )+import qualified Data.ByteString.Char8 as BSC (pack)+import qualified Network.Socket as N -- | this library does not try to discover peers. Config hints nodes to try to connect to nodeId::ServerId -> NodeId nodeId id0 = NodeId $ encodeEndPointAddress host1 port1 0 where host1 = host id0- port1 = show $ port id0 + port1 = show $ port id0++-- | Encode end point address. From network-transport-tcp Network.Transport.TCP.Internal+encodeEndPointAddress :: N.HostName+ -> N.ServiceName+ -> EndPointId+ -> EndPointAddress+encodeEndPointAddress host0 port0 ix0 = EndPointAddress . BSC.pack $+ host0 ++ ":" ++ port0 ++ ":" ++ show ix0
src/Main.hs view
@@ -18,12 +18,19 @@ main = do [path0, idx0] <- getArgs Right c1 @ (Cluster conf1) <- readParse path0::IO (Either String Cluster)- let this1 = conf1 !! (read idx0::Int)- thisport1 = show $ port this1- backend1 <- initializeBackend (host this1) thisport1+ let idx1 = read idx0::Int+ idKnown c1 $ Tagged idx1+++idKnown::Cluster -> Tagged Slb Int -> IO()+idKnown cl1@(Cluster cl0) idx1@(Tagged idx0) = do+ backend1 <- initializeBackend (host id1) thisport1 (__remoteTable initRemoteTable) node1 <- newLocalNode backend1 Node.runProcess node1 - (master backend1 c1 - (Tagged $ read idx0::Tagged Slb Int)+ (master backend1 cl1 + idx1 ())+ where thisport1 = show $ port id1+ id1 = cl0 !! idx0 +
test-conf.json view
@@ -1,16 +1,16 @@ [ { - "host": "localhost",+ "host": "127.0.0.1", "port": 54001, "service": "hello" }, {- "host": "localhost",+ "host": "127.0.0.1", "port": 54002, "service": "hello" }, {- "host": "localhost",+ "host": "127.0.0.1", "port": 54003, "service": "hello" }
− test/Main.hs
@@ -1,4 +0,0 @@-module Main where--main::IO()-main = pure ()
+ test/TestMain.hs view
@@ -0,0 +1,4 @@+module TestMain where++main::IO()+main = pure ()