3

I need to persist some configuration data in a database/store. JSON data can be validated with an existing Yang model. One of the requirements is to keep track of each leaf and leaf-list item and quickly rollback to a previous version. Do you think converting to XML and storing in a XML database makes sense? Or should I convert it to key-value store? Any specific database suggestion to make that process easy to marshall/unmarshall between raw data to JSON leveraging the Yang model?

tartar
  • 688
  • 4
  • 16
  • YANG is not a data format. It is a model, a schema. What you are saying is like saying: "my data is in XSD schema format", which makes no sense. The standard data formats for data modeled with YANG would be XML and JSON. Sounds like you are trying to implement a server? – predi Sep 26 '16 at 08:38
  • Thanks for the suggestion maybe that explains lack of interest for this question. Yep this is for a generic configuration database of VMs. – tartar Sep 26 '16 at 17:11
  • Your question seems very interesting at first glance and a bit underspecified at second glance. Try to provide a simplified but complete example/workflow, covering 2-3 versions of a simple JSON, when validation occurs, what rollback means, especially with respect to the JSON versions following (are they discarded?), are successive JSON versions forming a tree / branching or are they strictly sequential, how quick is quick (a few milliseconds, a few seconds). Best case scenario, answers will be coming. Worst case scenario, after formulating your problem you will find the answer yourself. :) – xnakos Sep 29 '16 at 10:44

1 Answers1

1

Persistence and validation must be separated here.

Some databases (like MySQL 5.7) allows to store JSON values and validate JSON objects before insert (but without validation on Yang model, so you just have to validate it in your code before you store the data). And also, any sql-database can support version or timestamp column to help you show the versions and use the proper one.

Sometimes databases can not do all the business logic of your app, and it requires to write code.

yvs
  • 507
  • 3
  • 19