Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- runService :: Loggable a => Service -> Int -> [Cloud ()] -> Cloud a -> TransIO ()
- callService :: (Subst1 a String, Loggable a, Loggable b) => Service -> a -> Cloud b
- callService' :: (Loggable a, Loggable b) => Node -> a -> Cloud b
- callServiceFail :: (Typeable a, Typeable b, Loggable a, Loggable b) => Node -> a -> Cloud b
- serve :: (Loggable a, Loggable b) => (a -> Cloud b) -> Cloud ()
- ping :: Node -> Cloud ()
- monitorNode :: Node
- monitorService :: [([Char], [Char])]
- setRemoteJob :: ByteString -> Node -> TransIO ()
- killRemoteJob :: Node -> ByteString -> Cloud ()
- initService :: Service -> Cloud Node
- authorizeService :: MonadIO m => String -> Service -> m Bool
- requestInstance :: Service -> Int -> Cloud [Node]
- requestInstanceFail :: Node -> Int -> Cloud [Node]
- requestInstanceHost :: String -> Service -> Cloud Node
- findInNodes :: Service -> TransIO [Node]
- endMonitor :: IO ()
- freePort :: MonadIO m => m Int
- controlNodeService :: Node -> Cloud a
- controlNode :: Node -> Cloud a
- data GetNodes = GetNodes
- newtype GetLog = GetLog Node
- data ReceiveFromNodeStandardOutput = ReceiveFromNodeStandardOutput Node ByteString
- controlToken :: ByteString
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.
monitorNode :: Node Source #
monitorService :: [([Char], [Char])] Source #
setRemoteJob :: ByteString -> Node -> TransIO () Source #
killRemoteJob :: Node -> ByteString -> Cloud () Source #
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.
endMonitor :: IO () Source #
controlNodeService :: Node -> Cloud a Source #
controlNode :: Node -> Cloud a Source #
implementation details
data ReceiveFromNodeStandardOutput Source #