sysrepo  2.2.170
YANG-based system repository for all-around configuration management.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sysrepo Plugins

Sysrepo itself supports 2 kinds of plugins not to be confused with sysrepo-plugind plugins. Datastore plugins define a set of callbacks that implement all the operations performed on a datastore allowing to implement a completely custom datastore. Every datastore for every YANG module can use a different datastore implementation. Notification plugins is the exact same concept used for implementing storage of notifications stored for replay.

There are 2 main reasons for implementing a custom datastore plugin. Firstly, it is almost a necessity when adding Sysrepo support for an existing application/daemon with its own configuration. Normally, the configuration would have to be stored both in the app configuration and a Sysrepo datastore, which has severe disadvantages. Not only is the configuration stored twice but keeping both configurations consistent is next to impossible, which then causes problems if different data are stored in each configuration. Datastore plugin essentially allows to hook the app configuration directly into Sysrepo so all the Sysrepo datastore operations such as load or store will be performed using the app configuration.

Secondly, the performance. The default datastore implementation is using libyang JSON files that are completely generic and can store any YANG data but some operations may take much longer than necessary and even require more space than a specialized datastore would. The main disadvantage of JSON files in terms of efficiency is performing small changes on large data. In this case the whole data must be parsed, the change performed, and the whole updated data written back. Instead, another datastore may be able to store the change directly without parsing and printing all the other stored data. As for the space required, if implementing a datastore for a specific YANG module, the data structure can fully depend on the schema nodes defined in the module and hence avoid storing any redundant information. Finally, note that the internal JSON datastore is also implemented as a datastore plugin so it can be used as an example implementation.

Datastore Plugin API

Notification Plugin API