Module Join.Site

module Site: sig .. end

Sites are abstractions of JoCaml runtimes. Sites have unique identities, which can be passed on channels, computed from Internet addresses or extracted from asynchronous channels.

Sites must be compared with the equal and compare functions of this module. Sites are useful for performing crude failure detection (See Join.Site.at_fail below).

type t 
The type of site identities.
val here : t
Local site identity.
val there : Unix.sockaddr -> t
Get identity of the remote site listening on sockaddr. Raise Failure if the connection cannot be established.
val listen : Unix.sockaddr -> unit
Start to listen for connections on the socket address given as argument. Raises Failure in case of failure.
val where_from : 'a Join.chan -> t
where_from c returns the identity of the remote site where reception on channel c takes place.
val equal : t -> t -> bool
Test the equality of two sites.
val compare : t -> t -> int
Compare two sites, order is arbitrary.
val at_fail : t -> unit Join.chan -> unit
at_fail s c registers channel c as a guard on failure of site s. If s failure is detected, a message () is sent on channel c.

At the moment, site failure detection is a bit unsafe, due to naive routing. A failure may express the impossibility to contact a remote site for the first time.

val get_local_addr : unit -> Unix.inet_addr
Returns the default Internet address of the local site, never fails. At worst, get_local_addr () returns the loopback address Unix.inet_addr_loopback