uf:totam
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
uf:totam [2010/10/20 17:54] – elisag | uf:totam [2021/09/24 10:49] (current) – [Creating a tuplespace and tuples] elisag | ||
---|---|---|---|
Line 20: | Line 20: | ||
Figure above illustrates how a scoped tuple is propagated through the TOTAM network. It depicts two types of locations, the blue and red locations corresponding to two teams of a multi-player game scenario where users (blue team) can use their PDA’s to chase dangerous (virtual) gangsters (red team) in the outdoors. The scope of the propagated tuple has been limited to blue locations. Figure (a) illustrates that a tuple is injected from the location with a star. This location is connected to four blue locations and one red location. As the scope of the tuple is limited to blue locations the tuple is only sent to the four blue locations. From those four locations the tuple is transitively propagated obeying the scope of the tuple until all connected blue locations are reached without being transmitted to a red location. Note that one blue location is not transitively connected to the sending device and thus does not receive the tuple. Figure (b) illustrates that a blue location moved into the range of the isolated blue location and thus, transmits the tuple to it. Again the tuple is not transmitted to nearby red locations. It is important to note from this operational sketch that the first isolated location receives a tuple without being connected at any time with the start location in which the tuple was originally inserted. | Figure above illustrates how a scoped tuple is propagated through the TOTAM network. It depicts two types of locations, the blue and red locations corresponding to two teams of a multi-player game scenario where users (blue team) can use their PDA’s to chase dangerous (virtual) gangsters (red team) in the outdoors. The scope of the propagated tuple has been limited to blue locations. Figure (a) illustrates that a tuple is injected from the location with a star. This location is connected to four blue locations and one red location. As the scope of the tuple is limited to blue locations the tuple is only sent to the four blue locations. From those four locations the tuple is transitively propagated obeying the scope of the tuple until all connected blue locations are reached without being transmitted to a red location. Note that one blue location is not transitively connected to the sending device and thus does not receive the tuple. Figure (b) illustrates that a blue location moved into the range of the isolated blue location and thus, transmits the tuple to it. Again the tuple is not transmitted to nearby red locations. It is important to note from this operational sketch that the first isolated location receives a tuple without being connected at any time with the start location in which the tuple was originally inserted. | ||
+ | |||
+ | |||
+ | |||
+ | |||
===== API ===== | ===== API ===== | ||
Line 25: | Line 29: | ||
TOTAM has been implemented in AmbientTalk. The system library shipped with AmbientTalk contains the TOTAM implementation under at/ | 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: | In order to use TOTAM, you need to load the library and create a TOTAM tuple space as follows: | ||
Line 33: | Line 38: | ||
</ | </ | ||
- | A description can be passed in the '' | + | A description can be passed in the '' |
+ | |||
+ | To create a tuple or a template | ||
< | < | ||
// a “hallo” message tuple from wolf. | // a “hallo” message tuple from wolf. | ||
- | def halloTuple := tuple: [Message, “wolf”, “hallo”]; | + | def halloTuple := tuple: ["Message", “wolf”, “hallo”]; |
// a template for message tuples from wolf. | // a template for message tuples from wolf. | ||
- | def wolfTuples := tuple: [Message, “wolf”, var: `content]; | + | def wolfTuples := tuple: ["Message", “wolf”, var: `content]; |
// a template for any message tuples. | // a template for any message tuples. | ||
- | def msgTuples := tuple: [Message, var: `from, var: `content]; | + | def msgTuples := tuple: ["Message", var: `from, var: `content]; |
</ | </ | ||
+ | |||
+ | |||
+ | ==== Adding and Reading Tuples ==== | ||
TOTAM provides operations to add and read tuples from the tuple space as follows: | TOTAM provides operations to add and read tuples from the tuple space as follows: | ||
Line 54: | Line 64: | ||
</ | </ | ||
- | The '' | + | The '' |
- | Note that these operations | + | |
+ | In the original Linda model, read and in operations | ||
+ | |||
+ | < | ||
+ | def msgTuples := tuple: [Message, var: `from, var: `content]; | ||
+ | myTupleSpace.whenever: msgTuples read:{ | ||
+ | system.println(“Got message: “ + content + “ from: ” + from); | ||
+ | }; | ||
+ | |||
+ | myTupleSpace.whenever: | ||
+ | system.println(“ “ + from + “ says: “ + content); | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | The '' | ||
+ | |||
+ | The '' | ||
< | < | ||
Line 64: | Line 90: | ||
Note that the network facilities are disabled by default, so before injecting something in the network, the '' | Note that the network facilities are disabled by default, so before injecting something in the network, the '' | ||
- | A tuple injected | + | ==== Tuple' |
+ | |||
+ | Similar to TOTA, public tuples are replicated and shared amongst devices when devices come into communication range. We thus say that tuple are propagated into the //TOTAM network//, i.e. a logical network formed by all devices which host a TOTAM tuple space. The spread of tuples into the TOTAM network can be controlled by means of a propagation protocol. Each tuple injected | ||
< | < | ||
Line 75: | Line 103: | ||
def decideStore(ts) {true}; | def decideStore(ts) {true}; | ||
// | // | ||
- | def inScope(descriptor){ true }; | + | def inScope(senderDescriptor, |
def decideDie(ts){false}; | def decideDie(ts){false}; | ||
}; | }; | ||
Line 81: | Line 109: | ||
</ | </ | ||
- | However, other propagation protocols can be created and attached to a tuple before being injected in the network as follows: | + | Custom |
< | < | ||
//define a new propagation protocol | //define a new propagation protocol | ||
def blueProtocol := propagationProtocol: | def blueProtocol := propagationProtocol: | ||
- | def inScope(descriptor) { descriptor.team == " | + | def inScope(senderDescriptor, |
+ | receiverDescriptor.team == " | ||
}; | }; | ||
// attach the protocol to a tuple | // attach the protocol to a tuple | ||
- | def aBlueTuple := tuple: [Message, " | + | def aBlueTuple := tuple: ["Message", " |
- | withPropagationProtocol: | + | withPropagationProtocol: |
// inject the tuple to the network | // inject the tuple to the network | ||
def publication := inject: aBlueTuple; | def publication := inject: aBlueTuple; | ||
</ | </ | ||
- | The '' | + | The '' |
< | < | ||
- | // sends an antituple to notify the removal of this tuple. | + | // 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(); | publication.retract(); | ||
</ | </ | ||
- | In order to notify | + | Upon a '' |
+ | Upon a '' | ||
+ | < | ||
+ | Note that '' | ||
+ | </ | ||
Line 115: | Line 151: | ||
**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. | **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:// | ([[ http:// | ||
+ | |||
+ | < | ||
+ | </ |
uf/totam.1287590082.txt.gz · Last modified: 2012/03/27 11:01 (external edit)