transient-universe-0.6.0.1: fully composable remote execution for the creation of distributed systems

Safe HaskellNone
LanguageHaskell2010

Transient.Move.Services

Contents

Description

 
Synopsis

Documentation

runService :: Loggable a => Service -> Int -> [Cloud ()] -> Cloud a -> TransIO () Source #

executes a program that export endpoints that can be called with callService primitives. It receives the service description, a default port, the services to set up and the computation to start. for example the monitor exposes two services, and is started with:

 main = keep $ runService monitorService 3000 $
                      [serve returnInstances
                      ,serve addToLog] someComp

every service incorporates a ping service and a error service. The later invoqued when the parameter received do not match with any of the endpoints implemented.

callService :: (Subst1 a String, Loggable a, Loggable b) => Service -> a -> Cloud b Source #

call a service. If the service is not running in some node, the monitor service would install and run it. The first parameter is a weak password.

callService' :: (Loggable a, Loggable b) => Node -> a -> Cloud b Source #

call a service located in a node

callServiceFail :: (Typeable a, Typeable b, Loggable a, Loggable b) => Node -> a -> Cloud b Source #

notify the the monitor that a node has failed for a service and reclaim another to execute the request. If the service is not running in some node, the monitor service would install and run it. The first parameter is a weak password.

serve :: (Loggable a, Loggable b) => (a -> Cloud b) -> Cloud () Source #

execute the individual services. A service within a program is invoked if the types of the parameters received match with what the service expect. See runService for a usage example

ping :: Node -> Cloud () Source #

ping a service in a node. since services now try in other nodes created by the monitor until succees, ping can be used to preemptively assure that there is a node ready for the service.

initService :: Service -> Cloud Node Source #

initService search for any node in the list of nodes that the local node may know, for that service, instead of calling the monitor. if there is no such node, it request an instance from the monitor requestInstance. initService is used by callService

requestInstance :: Service -> Int -> Cloud [Node] Source #

receives the specification of a service and install (if necessary) and run it (if necessary) if the servi ce has been started previously, it returns the node immediately. if the monitor service executable is not running requestInstace initiates it. Instances are provisioned among the available nodes The returned nodes are added to the list of known nodes.

implementation details