research:ambientrefs
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
research:ambientrefs [2006/06/27 12:11] – tvcutsem | research:ambientrefs [2006/07/11 21:20] – tvcutsem | ||
---|---|---|---|
Line 5: | Line 5: | ||
Ambient references are a novel remote object reference mechanism. Remote object references are " | Ambient references are a novel remote object reference mechanism. Remote object references are " | ||
- | == Motivation == | + | === Motivation |
One may wonder why new referencing abstractions are required for mobile networks. In order to motivate the need for new referencing abstractions at the language level, we list a number of desirable properties of remote references for mobile networks which current remote referencing abstractions do not offer: | One may wonder why new referencing abstractions are required for mobile networks. In order to motivate the need for new referencing abstractions at the language level, we list a number of desirable properties of remote references for mobile networks which current remote referencing abstractions do not offer: | ||
Line 14: | Line 14: | ||
- **Group Communication**: | - **Group Communication**: | ||
- | == Design == | + | === Design |
- | Ambient references unify two concepts: they are both a peer-to-peer discovery channel //and// an asynchronous communication channel to a remote object. | + | Ambient references unify two concepts: they are both a peer-to-peer discovery channel //and// an asynchronous communication channel to a remote object. When an ambient reference is **unbound** (i.e. it is a dangling pointer), it is acting as a discovery channel, actively looking for remote service objects in the environment to bind to. Once such a suitable ((What exactly constitutes a " |
- | == Example Usage == | + | When the service object to which an ambient reference is bound moves out of communication range, the ambient reference can become unbound again. It becomes a dangling pointer anew and immediately becomes a peer discovery mechanism again: the ambient reference will try to //rebind// to the same or another matching service. |
- | == Implementation == | + | == Describing services == |
+ | |||
+ | An ambient reference is always initialized with a //service type// which denotes remote objects intensionally by the service it provides. One may, for example, declare an ambient reference to a nearby printer: | ||
+ | |||
+ | <code javascript> | ||
+ | printer = ambient Printer; | ||
+ | </ | ||
+ | |||
+ | The code excerpt above creates an ambient reference to an object providing the '' | ||
+ | |||
+ | The primary advantage of using such service types rather than e.g. name servers, IP addresses or URLs is, evidently, abstraction over the machine address of the host providing the services. Ambient references can be used to refer to service objects, the host address of which is unknown to the code declaring the reference. All that needs to be agreed upon is a matching service type. | ||
+ | |||
+ | == Communicating with services == | ||
+ | |||
+ | Asynchronous messages may be sent to an ambient reference at any point in time. For example, in order to print a document on a nearby printer, the '' | ||
+ | |||
+ | <code javascript> | ||
+ | printer< | ||
+ | </ | ||
+ | |||
+ | In this example code ''< | ||
+ | |||
+ | One may wonder how return values can be acquired from such asynchronous message sends. We use the concept of a **future**, which is a very well known concept that unifies asynchronous message passing with return values. More specifically, | ||
+ | |||
+ | <code javascript> | ||
+ | answer = printer< | ||
+ | when(answer) lambda(ok) -> { | ||
+ | if (ok) | ||
+ | print(" | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | == Synchronising with the ambient == | ||
+ | |||
+ | Sometimes it is useful to know when a matching service has become available and to act upon that event. Equally useful is the ability to act upon the unavailability of a previously discovered service. Ambient references cater to such behaviour by providing for a number of observers which can monitor the state of the reference. Reusing the printer example, here's how one can keep a list of nearby printing services up-to-date: | ||
+ | |||
+ | <code javascript> | ||
+ | printer = ambient Printer; | ||
+ | printers = []; | ||
+ | when-found(printer) lambda(foundService) { | ||
+ | printers.add(foundService) | ||
+ | } | ||
+ | when-lost(printer) lambda(lostService) { | ||
+ | printers.remove(lostService) | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | The '' | ||
+ | |||
+ | == Design Dimensions == | ||
+ | |||
+ | One may notice from the above description of ambient references that their behaviour of binding and rebinding is not always what is desired. Furthermore, | ||
+ | |||
+ | * **Scope of binding**: it is possible to restrict the set of remote service objects to which an ambient reference may bind even further, by using so-called filter queries. For example, suppose one only wants to send documents to a printer that supports a resolution greater than 400 dpi. This can be expressed as: | ||
+ | <code javascript> | ||
+ | printer = ambient Printer p where p.dpi > 400; | ||
+ | </ | ||
+ | * **Elasticity**: | ||
+ | <code javascript> | ||
+ | printer = ambient(1min) Printer; | ||
+ | </ | ||
+ | * **Cardinality**: | ||
+ | <code javascript> | ||
+ | cars = ambient* Car; | ||
+ | cars< | ||
+ | </ | ||
+ | |||
+ | For more details regarding all of these design dimensions, have a look at the further reading section below. | ||
+ | |||
+ | In conclusion, what is important to recall is that an ambient reference is a remote object reference that may be in two states: it can be unbound, searching for a matching object or it can be bound, becoming an asynchronous communication channel to a remote object. The programmer can tweak **what** objects can be bound to, **how long** it should bind with an object and **how many** objects an ambient reference can bind to simultaneously. | ||
+ | |||
+ | === Implementation | ||
A detailed explanation of ambient references can be found in [[ftp:// | A detailed explanation of ambient references can be found in [[ftp:// | ||
- | == Further Reading == | + | === Further Reading |
Ambient References: Addressing Objects in Mobile Networks. Tom Van Cutsem, Jessie Dedecker, Stijn Mostinckx, Elisa Gonzalez Boix, Theo D' | Ambient References: Addressing Objects in Mobile Networks. Tom Van Cutsem, Jessie Dedecker, Stijn Mostinckx, Elisa Gonzalez Boix, Theo D' | ||
+ | |||
+ | Also see the [[research: |
research/ambientrefs.txt · Last modified: 2010/09/13 15:13 by tvcutsem