This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
uf:totam [2010/01/21 17:35] elisag updating |
uf:totam [2021/09/24 10:49] (current) elisag [Creating a tuplespace and tuples] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Tuples | + | ====== Scoped |
- | TOTAM is a communication abstraction to enable pervasive social interactivity: | + | TOTAM is tuple space model geared towards mobile ad hoc networks which provides |
- | The basic communications API of the framework provides means to address | + | TOTAM adopts features |
- | However, communicating | + | In TOTAM, tuple spaces are annotated |
- | Instead, we have designed | + | The novelty |
- | ==== Design | + | ===== Motivation ===== |
- | The original idea was to build a framework similar to TOTA [[http:// | + | [[http:// |
+ | These propagation rules are crucial to provide programmers with a flexible mechanism to achieve context-awareness based not only on connectivity but also on semantic information. | ||
- | However, in TOTA tuples are sent to all communication partners in range. Upon arrival at the receiver side, the tuple itself decides whether it has to be stored in that tuple space. By transmitting tuples potential malicious or non-intended users are provided with sensitive information. Not only does sending all tuples blindly to all communication partners in range raise privacy issues, it also creates a network traffic overhead. | + | However, in TOTA tuples are sent to all communication partners in range. Upon arrival at the receiver side, the tuple itself decides whether it has to be stored in that tuple space. As all devices can potentially access all information, |
- | To solve this issues, we extended TOTA with dynamically scoped tuples given rise to the TOTAM ("Tuples | + | ===== Scoped |
- | Another goal was to implement TOTAM as a general framework so that we can then instantiate our TOTAM with guanote objects for the [[: | + | TOTAM provides the programmer |
- | ==== API ==== | + | {{: |
- | Here comes the public interface | + | Figure above illustrates how a scoped tuple is propagated through |
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== API ===== | ||
+ | |||
+ | TOTAM has been implemented in AmbientTalk. The system library shipped with AmbientTalk contains the TOTAM implementation under at/ | ||
+ | |||
+ | ==== Creating a Tuplespace and Tuples ==== | ||
+ | |||
+ | In order to use TOTAM, you need to load the library and create a TOTAM tuple space as follows: | ||
< | < | ||
- | makeTupleSpace() | + | import / |
- | makeTuple(tupleID) | + | def myTupleSpace := makeTupleSpace(); |
- | extendTuple: | + | </ |
+ | |||
+ | A description can be passed in the '' | ||
+ | |||
+ | To create a tuple or a template (i.e. a tuple with wildcards or " | ||
+ | < | ||
+ | // a “hallo” message tuple from wolf. | ||
+ | def halloTuple := tuple: [" | ||
+ | // a template for message tuples from wolf. | ||
+ | def wolfTuples := tuple: [" | ||
+ | // a template for any message tuples. | ||
+ | def msgTuples := tuple: [" | ||
</ | </ | ||
- | A tuple space (ts) in AmbientTota basically consists of a local ts, an ambient ts (to inject | + | |
+ | ==== Adding and Reading Tuples ==== | ||
+ | |||
+ | TOTAM provides operations | ||
< | < | ||
- | // tota operations | + | // add tuple to tuple space |
- | def add(tuple) | + | myTupleSpace.out(halloTuple); |
- | def delete(template) -> vector with the deleted | + | // get a Message tuple |
- | matching the template | + | def aMessageTuple := myTupleSpace.rdp(msgTuples); |
- | def read(template) -> vector with the matching tuples | + | // get all Message |
+ | def messageTuples := myTupleSpace.rdg(msgTuples); | ||
+ | </code> | ||
- | // | + | The '' |
- | def inject(tuple) | + | |
- | // places a listener on to the local TS ( ~ subscribe | + | In the original Linda model, read and in operations were provided |
- | // it returns a publication object | + | |
- | when: template matches:{ | tuple | | + | |
- | // code | + | |
- | } | + | |
- | //Templates are currently boolean expressions on tuples. | + | |
- | Example | + | |
- | { |guanote| | + | |
- | //methods belonging to the propagation protocol | + | < |
+ | def msgTuples := tuple: [Message, var: `from, var: `content]; | ||
+ | myTupleSpace.whenever: | ||
+ | system.println(“Got message: “ + content + “ from: ” + from); | ||
+ | }; | ||
- | // notifies the discovery of a remote ts | + | myTupleSpace.whenever: |
- | // and starts the propagation protocol | + | |
- | def notifyTSDiscovered(ts) | + | }; |
- | // notifies the arrival of tuples from a ts | + | |
- | // receive side of the propagation protocol | + | |
- | def receiveTyples(tuples) | + | |
</ | </ | ||
- | A tuple in our system | + | The '' |
+ | |||
+ | The '' | ||
< | < | ||
- | // called in every tuple at pass() | + | myTupleSpace.goOnline(); |
- | def decidePropagation() -> boolean | + | myTupleSpace.inject: halloTuple; |
- | // specifies operations on the local TS | + | |
- | def doAction | + | |
- | // specifies operations on the tuple itself | + | |
- | def changeTupleContent() -> tuple | + | |
- | // if true -> note gets added to local TS | + | |
- | def decideStore () -> boolean | + | |
- | // if true -> tuple gets unexported and deleted from local TS. | + | |
- | //new operation not in TOTA | + | |
- | def decideSleep() -> boolean | + | |
</ | </ | ||
- | decideSleep() is there for discontinuous decidePropagation functions. for example, tuples that should be only propagated | + | Note that the network facilities are disabled by default, so before injecting something in the network, the '' |
+ | |||
+ | ==== Tuple' | ||
+ | |||
+ | Similar to TOTA, public | ||
+ | |||
+ | < | ||
+ | def defaultPropagationProtocol(){ | ||
+ | isolate: { | ||
+ | // | ||
+ | def decideEnter(ts) { true }; | ||
+ | def doAction(ts){}; | ||
+ | def changeTupleContent(ts){self}; | ||
+ | def decideStore(ts) {true}; | ||
+ | // | ||
+ | def inScope(senderDescriptor, | ||
+ | def decideDie(ts){false}; | ||
+ | }; | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | Custom propagation protocols can be created and attached to a tuple before being injected in the network as follows: | ||
+ | |||
+ | < | ||
+ | //define a new propagation protocol | ||
+ | def blueProtocol := propagationProtocol: | ||
+ | def inScope(senderDescriptor, | ||
+ | receiverDescriptor.team == " | ||
+ | }; | ||
+ | // attach the protocol to a tuple | ||
+ | def aBlueTuple := tuple: [" | ||
+ | withPropagationProtocol: | ||
+ | // inject the tuple to the network | ||
+ | def publication := inject: aBlueTuple; | ||
+ | </ | ||
+ | |||
+ | The '' | ||
+ | |||
+ | |||
+ | < | ||
+ | // cancels the propagation of the tuple to new devices in the TOTAM network. | ||
+ | publication.cancel(); | ||
+ | // sends an antituple to notify the removal of this tuple in devices which carry a copy. | ||
+ | publication.retract(); | ||
+ | </ | ||
+ | |||
+ | Upon a '' | ||
+ | Upon a '' | ||
+ | |||
+ | |||
+ | < | ||
+ | Note that '' | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Further Reading ===== | ||
+ | |||
+ | **TOTAM: Scoped Tuples for the Ambient**, C. Scholliers, E. Gonzalez Boix, W. De Meuter. Proceedings of the Second International DisCoTec Workshop on Context-aware Adaptation Mechanisms for Pervasive and Ubiquitous Services (CAMPUS 2009), from Electronic Communications of the EASST, eds. 2009. | ||
+ | ([[ http:// | ||
+ | |||
+ | < | ||
+ | </ |