We have several types of bags that can be directly used in the application. To do so, you just have to use their name in the object description (See quinoa.py file).
Contrary to a set, a multiset is a bag that allows several identical resources to be present at the same time in the bag. In order to allow flexibility in this bag we define aspects that modify parts of the semantic of this bag. In fact this modification of the semantic is done by modifying the individual semantic associated to the operation of the protocol rd(), get(), put(), ...
You may find here after the list of aspects
The KeyLength allows to range from classical multiset to set. Using a multiSet is useful when we want to have several times the same resource. For instance consider a bag that model a purse. You can have several exemplary on the same coin.
On the contrary, a set is useful when you want to ensure the each kind of resource is in a unique exemplary in the bag. For instance, consider a bag that model all the types of sensor you can have into your system. Once each sensor has inserted its type in the bag, you automatically have the list of available type of sensors without any particular treatment.
Finally, yeyed multiset, with a part of the resource that is considered as a key ensures that you will have a single resource corresponding to the key. For instance, you can consider a bag that reflects the status of a group of sensors. If we set the keylength to 1 and the first field is the sensor name, each time a new resource coming from a sensor is inserted to reflect the current state, the previous state is overwritten. This ensures that you will be able to access all the time to the last state of the sensor.
The Blocking aspect allows to deal with 2 different behaviors in a rule.
Blocking = True, the system wait until a resource become available. For instance, if I have a rule that wait for the termination of a print to send an e-mail to the owner. It is useful to wait. On the contrary, if I have to print something, preferably on a color printer but I accept a black and white if no color printer is available. In this case, I will use Blocking = False for the search of the color printer in order to cut the rule for printing in color. Then, the alternative rule with black and white will do the job.
The ReadOnly aspect allows to change a classical bag to a bag that would have an infinite number of any of its resources. It is like when you do shopping of the Internet. It is not because you buy an hard disk that the shop do no longer offer this hard disk on its web page (ReadOnly = True). On the contrary, for the management of the stock the special exemplary you just bought disappear from the stock (ReadOnly = False).
The main interest of that is performance, if we know by advance that the result of the first phase of the transaction is always positive, it is not required to pay the price to ask the bag.
We can summarize the impact of the aspects on the basic operations of the protocol
| Impact of the aspects on the operations | ReadOnly | Transactional | KeyLength | Blocking| |---|---|---|---|---|---| | operation concerned | confirm() after get() | get() and put() | confirm() after put() | rd() | |default value | False | True | 0 | True | | default behavior | remove resource | get() and put() performed | insert resource in any case | block until compatible resource appears| | alternate behavior | resource is not physically removed | get() and put() skipped, return always ok | insert resource only if key is different | non blocking|