PPS supports pathname open options, and objects and attribute qualifiers. PPS uses pathname open options to apply open options on the file descriptor used to open an object. Object and attribute qualifiers set specific actions to take with an object or attribute; for example, make an object non-persistent, or delete an attribute.
PPS objects support an extended syntax on the pathnames used to open them. Open options are added as suffixes to the pathname, following a question mark (“?”). That is, the PPS service uses any data that follows a question mark in a pathname to apply open options on the file descriptor used to access the object. Multiple options are separated by question marks. For example:
The syntax used for specifying PPS pathname open query options will be easily recognizable to anyone familiar with the getsubopt() library routine. |
Supported pathname open options include:
The critical option can be used as an attribute cleanup mechanism on the abnormal termination of a publisher.
If this option is used when opening a file descriptor for a write, when the file descriptor is closed PPS deletes all non-persistent attributes and prefixes an asterisk (“*”) to the object name in the notification string it sends to all subscribers. PPS does not provide a list of the deleted attributes.
You should ensure that you never have duplicate critical or server file descriptors.
You should never have more than one critical file descriptor for any one PPS object.
File descriptors can be duplicated, either explicitly by dup(), dup2() or fcntl(), etc.; or implicitly by fork(), spawn(), etc. Duplicated descriptors in effect increment a reference count on the underlying critical descriptor. The behavior required of critical objects (the notification and deletion of volatile attributes) is not triggered until the reference count for a file descriptor drops to zero, indicating that the original and all duplicates are closed.
However, if you open a PPS object more than once in critical mode, each file descriptor behaves as a critical descriptor: if the reference count of any one file descriptor drops to zero, the notification and deletion behavior is triggered for the object — even if other descriptors remain open.
Do not duplicate server file descriptors. Behavior with duplicate server file descriptors is undetermined. |
Object and attribute qualifiers are contained in square brackets (“[qualifier]”), and prefixed to lines containing an object or an attribute name.
You can set qualifiers to read() and write() calls by starting a line containing an object or attribute name with an open square bracket, followed by a list of single-letter or single-numeral qualifiers and terminated by a close square bracket.
Qualifiers supported for objects and attributes are:
Qualifiers supported for attributes only are:
|
If nothing precedes a qualifier, that qualifier is set. It the qualifier is preceded by a minus sign (“-”), that qualifier is cleared. If a qualifier is not specified, that qualifier is not changed. For example:
The no-persistence qualifier can be used for objects and attributes. It is very useful on attributes that may not be valid across a system restart and do not need to be saved.
The table below describes the effects of the no-persistence qualifier on PPS objects and attributes:
Syntax | Action | Object | Attribute |
---|---|---|---|
n | Set | Make the object and its attributes non-persistent; ignore any persistence qualifiers set on this object's attributes. | Make the attribute non-persistent. |
-n | Clear | Make the object persistent; persistence of the object's attributes is determined by the individual attribute's qualifiers. | Make the attribute persistent, if the attribute's object is also persistent. |
Setting the no-persistence qualifier on an object overrides any no-persistence qualifiers set on the object's attributes, and is therefore convenient if you need to make a temporary object in which nothing persists.
For more information about persistence, see the chapter Persistence.
The item qualifier can be used for attributes only. It causes PPS to treat the value following the qualifier as a set of items. Items in a set are separated by a user-defined separator, such as a comma.
The item separator:
You may add or delete only one set item at a time. For example, to add items to a set:
[i]items::hammer, [i]items::screw driver,
Or, to delete an item from a set:
[-i]items::hammer,
The following are not permitted:
[i]items::hammer,screw driver,
Or:
[-i]items::hammer,screw driver,
In the examples below, the separator is a comma: “,”.
This example shows that PPS ignores a duplicate attempt to add the same item to a set. The following lines written:
[i]items::hammer, [i]items::hammer, [i]items::screw driver,
would result in the following being read by a subscriber:
items::hammer,screw driver,
This example shows how PPS supports a null item in a set. The following line written to the set created in the previous example:
[i]items::,
would result in the following being read by a subscriber:
items::hammer,screw driver,,
This example shows how to delete an item from a set. The following line written to the set created and updated in the previous examples:
[-i]items::hammer,
would result in the following being read by a subscriber:
items::screw driver,,