alice
library
manual.

Alice Project

The Remote structure


________ Synopsis ____________________________________________________

    signature REMOTE
    structure Remote : REMOTE

This structure provides support for the implementation of distributed applications. This includes exporting values from and importing values into sites, performing remote function application and starting a new site. See the distribution overview for an introduction to the distribution facilities provided by Alice.

Communication between sites is performed by cloning data structures. Cloning is defined by pickling.

The current implementation uses HTTP as the transport protocol. Accordingly, tickets are URLs using the http scheme.

See also: COMPONENT_MANAGER, Url, Pickle


________ Import ______________________________________________________

    import structure Remote from "x-alice:/lib/distribution/Remote"
    import signature REMOTE from "x-alice:/lib/distribution/REMOTE-sig"

________ Interface ___________________________________________________

    signature REMOTE =
    sig
	type ticket = string

	exception Ticket
	exception Sited
	exception Protocol of int * string

	val proxy : ('a -> 'b) -> ('a -> 'b)

	val offer : package -> ticket
	val take : ticket -> package

	functor Offer (signature S  structure X : S) : (val ticket : ticket)
	functor Take (val ticket : ticket  signature S) : S

	functor Execute (val host : string
			 signature RESULT
			 functor Start (ComponentManager : COMPONENT_MANAGER) : RESULT) : RESULT
    end

________ Description _________________________________________________

type ticket = string

The type of tickets representing offered values. Tickets are short strings suitable for communication, for instance, over voice lines or by email. Tickets are suitable for parsing as URLs.

exception Ticket

indicates that a ticket was not well-formed or referred to a site or value that could not be accessed.

exception Sited

indicates that the argument or result of a call to a proxy contained a sited value. Same as Component.Sited.

exception Protocol

indicates a protocol error.

proxy f

returns a proxy for f. The proxy differs from f in that:

When the site on which the proxy was created terminates, the proxy becomes invalid. Applications of the proxy on other sites will raise the Ticket exception.

offer package

makes package available to other sites for taking. Returns a ticket suitable for take or Take. If the argument is a mutable data structure, then taking returns a clone of how the data structure looked when the offer was initially made. An offered data structure can be taken any number of times.

take ticket

imports the data structure denoted by ticket, which must have been created by offer or Offer. Raises Ticket if the ticket is invalid or the site on which it was created no longer exists.

Offer (signature S = S structure X = X)

makes X available to other sites for taking with signature S. Returns a ticket suitable for take or Take. If the argument is a mutable data structure, then taking returns a clone of how the data structure looked when the offer was initially made. Equivalent to

	(val ticket = offer (pack X :> S))
Take (val ticket = ticket signature S = S)

imports the data structure denoted by ticket, which must have been created by offer or Offer, under signature S. Raises Ticket if the ticket is invalid or the site on which it was created no longer exists. Raises Package.Mismatch if the value was not exported with a signature matching S. Equivalent to

	unpack (take ticket) : S
Execute (val host = host signature RESULT = S functor Start = F)

creates a new site on host using ssh, transfers a clone of Start to the new site, on which it is applied to the local component manager. A clone of the resulting structure is transferred back to the caller of Execute and returned as the resulting structure.



last modified 1970/01/01 01:00