sleepinggenius2/gosmi

Can you add the ability to serialize the parsing results to local files and deserialize them from local files to parsed results?

nh-live opened this issue · 3 comments

Can you add the ability to serialize the parsing results to local files and deserialize them from local files to parsed results?

I'm not sure that I completely understand the question. Once you have the parsed data, you're free to serialize (marshal) it into whatever format you see fit. For example, I know it works just fine with encoding/json. Deserializing (unmarshaling) should work just the same, but in reverse. Please provide more details about what you are expecting from the library in this respect.

After using gosmi, the parsed data is stored as a file, and the program will not need to re parse after restart, but read the saved parsed data file directly.

I'm still not really sure what you are trying to accomplish. All the public data structures should be serializable in whatever format makes the most sense for your application (JSON, YAML, gob, etc.). The smi example includes dumping as JSON and my mib2go project provides a Go codegen option as well. Maintaining application state is a non-trivial task, which is outside of the scope of gosmi as a library, and something you will need to implement within your application.