User Tools

Site Tools


uf:totam

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
uf:totam [2020/04/28 19:41]
elisag adding
uf:totam [2021/09/24 10:49] (current)
elisag [Creating a tuplespace and tuples]
Line 29: Line 29:
 TOTAM has been implemented in AmbientTalk. The system library shipped with AmbientTalk contains the TOTAM implementation under at/lang/totam.at. TOTAM has been implemented in AmbientTalk. The system library shipped with AmbientTalk contains the TOTAM implementation under at/lang/totam.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 37: Line 38:
 </code>  </code> 
  
-A description can be passed in the ''makeTupleSpace'' operation in order to activate the scoping mechanism (as we will explain later).  To create a tuple or a template, the tuple operation can be used as follows:+A description can be passed in the ''makeTupleSpace'' operation in order to activate the scoping mechanism (as we will explain later).   
 + 
 +To create a tuple or a template (i.e. a tuple with wildcards or "holes"), the 'tuple:' operation can be used as follows:
 <code>  <code> 
 // a “hallo” message tuple from wolf. // a “hallo” message tuple from wolf.
Line 46: Line 49:
 def msgTuples := tuple: ["Message", var: `from, var: `content]; def msgTuples := tuple: ["Message", var: `from, var: `content];
 </code> </code>
 +
 +
 +==== 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 84: Line 90:
 Note that the network facilities are disabled by default, so before injecting something in the network, the ''goOnline()'' method must be called on the tuple space. Note that the network facilities are disabled by default, so before injecting something in the network, the ''goOnline()'' method must be called on the tuple space.
  
-tuple injected to the network carries the following default propagation protocol.+==== Tuple's Propagation Protocol ==== 
 + 
 +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 into the network carries a propagation protocol that can be customized by developers. What follows shows the default propagation protocol:
  
 <code> <code>
Line 101: Line 109:
 </code> </code>
  
-However, other propagation protocols can be created and attached to a tuple before being injected in the network as follows:+Custom propagation protocols can be created and attached to a tuple before being injected in the network as follows:
  
 <code> <code>
Line 116: Line 124:
 </code> </code>
  
-The ''propagationProtocol:'' operation creates a propagation protocol object which extends the default propagation protocol object with other semantics. this sample code shows a protocol based on the operational sketch figure that checks whether the receiver of the tuple is part of the blue team. This is attached to the tuple by means of the ''tuple:withPropagationProtocol:'' operation which is then injected into the network. The inject: operation returns a publication object which can be used as follows to remove the tuple from the network.+The ''propagationProtocol:'' operation creates a propagation protocol object which extends the default propagation protocol object with other semantics. this sample code shows a protocol based on the operational sketch figure that checks whether the receiver of the tuple is part of the blue team. This is attached to the tuple by means of the ''tuple:withPropagationProtocol:'' operation which is then injected into the network. The ''inject:'' operation returns a publication object which understands two methods:  
  
 <code> <code>
-// 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();
 </code> </code>
  
-Upon a ''retract'' operation, TOTAM injects in the network an antituple for the removed tuple. For every tuple there is (conceptually) a unique antituple with the same format and content, but with a different sign. All tuples injected by an application have positive sign while their antituples have a negative sign. Whenever a tuple and its antituple are stored in the same tuple space, they immediately annihilate one another, i.e. they both get removed from the tuple space. By means of antituples, TOTAM can “unsend” tuples injected to the network.+Upon a ''cancel'' operation, TOTAM stops the injection of the tuple into newly discovered devices in the TOTAM network.  
 +Upon a ''retract'' operation, TOTAM injects in the TOTAM network an antituple for the removed tuple. For every tuplethere is (conceptually) a unique antituple with the same format and content, but with a different sign. All tuples injected by an application have positive sign while their antituples have a negative sign. Whenever a tuple and its antituple are stored in the same tuple space, they immediately annihilate one another, i.e. they both get removed from the tuple space. By means of antituples, TOTAM can “unsend” tuples injected into the network.
  
  
 <note> <note>
-Note that ''retract'' is meant to be used by the creator of a tuple to stop the propagation of a tuple and remove it from the network. This is useful in cases that tuples injected carry outdate information. However, this operation should not be confused with the ''when:in:'' operation which allows applications to read and remove a tuple matching a template from the TOTAM network. +Note that ''retract'' is meant to be used by the creator of a tuple to stop the propagation of a tuple and remove it from the network. This is useful in cases that tuples injected carry outdate information. However, this operation should **not** be confused with the ''when:in:'' operation which allows applications to read and remove a tuple matching a template from the TOTAM network. 
 </note> </note>
  
uf/totam.1588095681.txt.gz · Last modified: 2020/04/28 19:41 by elisag