persist
type: Specification
name: LV2 Persist
developer: Leonard Ritter
maintainer: David Robillard
documentation: This extension provides a mechanism for plugins to save and restore state across instances, allowing hosts to save configuration/state/data with a project or fully clone a plugin instance (including internal state). Unlike ports, this extension allows plugins to save private state data. The motivating ideal behind this extension is for the state of a plugin instance to be entirely described by port values (as with all LV2 plugins) and a key/value dictionary as defined by this extension. This mechanism is simple, yet sufficiently powerful to describe the state of very advanced plugins. The "state" described by this extension is conceptually a single key/value dictionary. Keys are URIs, and values are typed-tagged blobs of any type. The plugin provides a save and restore method for saving and restoring state. To initiate a save or restore, the host calls these methods, passing a callback to be used for saving or restoring a single key/value pair. In this way, the actual mechanism of saving and restoring state is completely abstract from the plugin's perspective. Because the state is a simple dictionary, hosts and plugins can work with state easily (virtually all programming languages have an appropriate dictionary type available). Additionally, this format is simple and terse to serialise in many formats (e.g. any RDF syntax, JSON, XML, key/value databases such as BDB, etc.). In particular, state can be elegantly described in a plugin's Turtle description, which is useful for presets (among other things). Note that these are all simply possibilities enabled by this simple data model. This extension defines only a few function prototypes and does not impose any requirement to use a particular syntax, data structure, library, or other implementation detail. Hosts are free to work with plugin state in whatever way is most appropriate for that host. This extension makes it possible for plugins to save private data, but state is not necessarily private, e.g. a plugin could…

Plugin Instance State
type: Class
comment: This class is used to express a plugin instance's state in RDF. The key/value properties of the instance form the predicate/object (respectively) of triples with a persist:InstanceState as the subject (see persist:instanceState for an example). This may be used wherever it is useful to express a plugin instance's state in RDF (e.g. for serialisation, storing in a model, or transmitting over a network). Note that this class is provided because it may be useful for hosts, plugins, or extensions that work with instance state, but its use is not required to support the LV2 Persist extension.

instanceState
type: Property
range: Plugin Instance State
documentation: Predicate to relate a plugin instance to an InstanceState. This may be used wherever the state of a particular plugin instance needs to be represented. Note that the domain of this property is unspecified, since LV2 does not define any RDF class for plugin instance. This predicate may be used wherever it makes sense to do so, e.g.: @prefix eg: <http://example.org/> . <plugininstance> persist:instanceState [ eg:somekey "some value" ; eg:someotherkey "some other value" ; eg:favouritenumber 2 . ] Note that this property is provided because it may be useful for hosts, plugins, or extensions that work with instance state, but its use is not required to support the LV2 Persist extension.