-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A program for extending Stack to add distributed capabilities
--
-- See README at https://github.com/McGizzle/stack-network#readme
@package stack-network
@version 0.1.0.1
module Network.Distributed.Types
-- | Configuration for the master node
data AppConfig
AppConfig :: Int -> Backend -> AppConfig
-- | Number of slave nodes the master should wait for before attempting a
-- build
[nodes] :: AppConfig -> Int
[backend] :: AppConfig -> Backend
-- | NetProc Monad
--
-- Wraps Process with ReaderT
type NetProc a = ReaderT AppConfig Process a
-- | Run the NetProc Monad
runNetProc :: AppConfig -> NetProc a -> Process a
-- | Host and Port of a Node
data NetworkConfig
NetworkConfig :: String -> String -> NetworkConfig
[hostNetworkConfig] :: NetworkConfig -> String
[portNetworkConfig] :: NetworkConfig -> String
-- | A Node is used for communication
type Node = ProcessId
-- | A collection of Nodes
type Network = [Node]
-- | The dependecies a Node has, represented as a list of Strings
type Deps = [String]
-- | A Node and its dependencies
type ProcessDeps = (Deps, ProcessId)
-- | Tuple of file name and bytes
type FileInfo = (ByteString, ByteString)
-- | All Types used messaging are derived from a Message
data Message
Request :: Message
Response :: Message
-- | Only masters can make a Request
data Request
-- | Used to transmit masters ProcessId to a slave
Ping :: ProcessId -> Request
-- | Facilitates a Transfer
TransferReq :: (SendPort Transfer) -> Request
-- | Terminates a slaves connection to the network
Terminate :: Request
-- | Only slaves can issue a Reponse in reply to a Request
data Response
-- | Response to a Ping
PD :: ProcessDeps -> Response
-- | Reponse to a TransferReq
Transfer :: Response
-- | Data-Type used in a Transfer
data Transfer
-- | Transfer In Progress
TransferInProg :: FileInfo -> Transfer
-- | Informs master the Transfer is complete
TransferDone :: Transfer
-- | Errors covering a Process failing
data ProcessError
SlaveError :: ProcessError
instance GHC.Generics.Generic Network.Distributed.Types.Request
instance GHC.Generics.Generic Network.Distributed.Types.Transfer
instance GHC.Generics.Generic Network.Distributed.Types.Response
instance GHC.Show.Show Network.Distributed.Types.ProcessError
instance Data.Binary.Class.Binary Network.Distributed.Types.Request
instance Data.Binary.Class.Binary Network.Distributed.Types.Transfer
instance Data.Binary.Class.Binary Network.Distributed.Types.Response
instance GHC.Show.Show Network.Distributed.Types.NetworkConfig
module Network.Distributed.Utils
-- | Parsers configuration from provided network.config file
parseNetConfig :: IO NetworkConfig
-- | Logs to stdout in grey
log :: MonadIO m => String -> m ()
-- | Logs to stdout in green
logSucc :: MonadIO m => String -> m ()
-- | Logs to stdout in red
logWarn :: MonadIO m => String -> m ()
-- | Determines a nodes dependencies
listDeps :: MonadIO m => m [String]
-- | Finds the ProcessId with the most overlapp, returning Nothing if there
-- is no overlapp
getBestPid :: [(Deps, Node)] -> Deps -> (Maybe Node, Int) -> Maybe Node
-- | Cross-platform encoding of FilePath
encodePath :: FilePath -> ByteString
-- | Cross-platform decoding of FilePath
decodePath :: ByteString -> FilePath
-- | Times an action
--
-- Logs out the amount of seconds the action took
timeIt :: MonadIO m => m a -> m a
-- | Runs a build
runStackBuild :: IO ()
-- | Runs a timed build
runStackBuildT :: IO ()
module Network.Distributed.Transfer
-- | Internal function that executes a pipeline of effects
pipeFiles :: (MonadMask m, MonadIO m) => (Transfer -> m ()) -> m ()
-- | Packages a file by reading in its bytes
packageFile :: MonadIO m => FilePath -> m Transfer
-- | Produces output for the pipeline
producers :: MonadSafe m => Proxy x' x () FilePath m ()
module Network.Distributed.Process
-- | Runs a Process that is a master Node
runRequestNode :: Int -> NetworkConfig -> IO ()
-- | Internal for master Node
runRequestNode' :: NetProc ()
-- | Creates the Backend and runs a Process that is a slave
-- Node
joinNetwork :: NetworkConfig -> IO ()
-- | Internal for slave Node
joinNetwork' :: Process ()
-- | Internal function used to gather ProcessId's
findPids :: (MonadMask m, MonadProcess m, MonadReader AppConfig m) => m [ProcessId]
-- | Internal function used to get all slaves dependencies
gatherDeps :: (MonadProcess m, MonadMask m) => Network -> m [ProcessDeps]
-- | Internal function used to reveive the Transfer
receiveF :: MonadProcess m => ReceivePort Transfer -> m ()
-- | Faciliaties a safe Transfer bewteen nodes
withTransfer :: (Exception e, MonadProcess m, MonadCatch m) => [ProcessDeps] -> Deps -> (e -> m ()) -> (ProcessId -> (SendPort Transfer, ReceivePort Transfer) -> m ()) -> m ()
module Network.Distributed