Variables¶
Variables are value handled by osp-variables plugin. They allow for both read
and write
by multiple source. This allow users to interact with OnSphere directly from front-end for example. The results can be used to trigger callbacks.
Persistent value¶
A persisted variable is stored upon modification or initialization if a default is define.
The persistence is defined on the owner.variables.
Default value¶
A default value is published when the module starts. This default is defined on the owner.variables. For a persisted variable, the default is only published once when the variable is created for the first time. Then only the content of the persistence store is published.
Variable publishing¶
Startup¶
At startup, the osp-variables
plugin will try to load from disk all variables that were previously persisted and will publish those values with the RETRANSMISSION transmission mode. See persistent storage to understand how to configure a persisted volume.
A persisted variable is initialized with the default value during the first start.
Note
If a variable which no longer requires persistence is found on the disk, it is automatically erased to avoid potential ghost persisted values.
Modified value¶
When the plugin receives a write request for a variable that it holds, it will store the variable content (potentially on the disk, if persistence is enabled) and publish the value with the CHANGE transmission mode.
When the plugin receives a read request for a variable that it holds, it will fetch the variable current content and publish the value with the RETRANSMISSION transmission mode.
Conversion¶
When a variable type does not match with the content type, the module will automatically try to apply a conversion to get the proper type.