Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for database backends #785

Open
kwatsen opened this issue May 21, 2019 · 3 comments
Open

Support for database backends #785

kwatsen opened this issue May 21, 2019 · 3 comments
Assignees
Labels
is:enhancement Request for adding new feature or enahncing functionality.

Comments

@kwatsen
Copy link

kwatsen commented May 21, 2019

Looking into Sysrepo’s support for database backends, one can find Sysrepo#774, in which Radek makes this comment:

This will need support in libyang, which expect this way of enahncement, but not directly in a form of plugins. It will still need some (small) changes in sysrepo code then, but the first step is definitely support for storing and loading data in such format in libyang.

This issue is to track the support for this feature.

@kwatsen
Copy link
Author

kwatsen commented May 21, 2019

What intersection and/or kind of libyang modification would be needed?

For the most part, libyang seems to be independent of external data access layer (DAL) concerns. That said, I could imagine callbacks being registered into libyang to fetch parts of the schema and/or data tree from a DAL. Is this the idea?

@rkrejci
Copy link
Collaborator

rkrejci commented May 21, 2019

What I was talking about in the sysrepo issue, was a support for another data format in libyang next to XML, JSON and LYB format currently supported. Probably it can be in a form of some plugins that would implement a data printer and parser to get data out and into the internal data tree structures.

That was my idea. However, even what you wrote make sense. libyang is able to write data info FILE, file descriptor, memory or filepath. So here could be a place for plugin to actually convert XML string from memory into a database (or something else) and vice versa (from DB into XML string). The difference is in efficiency (the second approach will be worse) and simplicity (the second approach will be probably more simple).

What do you think about efficiency vs simplicity in this case. Probably it would be possible to allow both types of plugins, but then libyang could seem over-pluginned :)

@rkrejci rkrejci added the is:enhancement Request for adding new feature or enahncing functionality. label May 21, 2019
@rkrejci rkrejci added this to the libyang2 milestone May 21, 2019
@rkrejci rkrejci self-assigned this May 21, 2019
@kwatsen
Copy link
Author

kwatsen commented May 28, 2019

I'm unsure, but I think that the goals are two-fold:

  1. for apps with known-small data-models, having an in-memory instance all the time is reasonable and the only desire to use database is for ACID compliance.

  2. for apps with potentially huge data-model, having an the entire instance in-memory at any time is undesirable. Some way to incrementally read/write parts to a persistence layer would be desired. There would obviously be a need to define how the model is partitioned into persistable chunks, but that seems outside libyang's scope.

@rkrejci rkrejci removed this from the libyang2 - initial release milestone Jul 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:enhancement Request for adding new feature or enahncing functionality.
Projects
None yet
Development

No branches or pull requests

2 participants