Holumbus-Distribution-0.1.1: intra- and inter-program communication

Portabilityportable
Stabilityexperimental
MaintainerStefan Schmidt (stefanschmidt@web.de)

Holumbus.Distribution.DFunction

Contents

Description

Version : 0.1

This module offers distributed functions.

This idea behind this is to implement RPC based on DNodes. You specify a function which could be called from other programs and register this as a resource in your local DNode. Then the foreign DNodes can create a link to this function an execute it. The function parameters will be serialized and send to the local DNode. There the parameters are deserialized and the function will be called. After this the return-value will be send back to the calling node.

Synopsis

datatypes

data DFunction a Source

The DFunction datatype. This is more like a reference to a function located on a different node. You can call this function via the accessDFunction function.

Instances

class BinaryFunction a Source

Binary function typeclass. You can only use functions whose parameters and return value are serializable. The idea of this typeclass comes from the haxr library by Bjorn Bringert (http:www.haskell.orghaskellwikiHaXR)

Instances

creating and closing function references

newDFunction :: BinaryFunction a => String -> a -> IO (DFunction a)Source

Creates a new distributed function. Only functions which are registered at the local node can be called from the outside. The string parameter specifies the name of the function which could the used by other nodes to call it. If you leave it empty, a random name will be generated.

newRemoteDFunction :: BinaryFunction a => String -> String -> IO (DFunction a)Source

Created a reference to a function on a remote node. The first parameter is the name of the function, the second parameter is the name of the node.

closeDFunction :: DFunction a -> IO ()Source

Closes a DFunction reference.

invoking functions

accessDFunction :: BinaryFunction a => DFunction a -> aSource

Transforms a DFunction object to a normal function which could be called and passed around. Because you have network tranfer everytime you call the function, this might throw a DistributedException when the foreign node becomes unreachable.