Le 13/11/2018 à 16:56, John Spray a écrit :
However, what's to stop you just using a map of strings to OSDs in the
golang code, and unmarshalling to that? I'd be kind of surprised if
the golang JSON parser couldn't handle it.
I can surely make something like Unmarshal in a
map[string]json.RawMessage and address the structures directly from it.
This is not satisfying for the following reasons :
- this doesn't avoid loading a broken/incomplete input as there is no
more json validation here
- I don't have any structure data anymore meaning I cannot address items
directly like in osd.Hostname()
- I have to re-implement accessors for every items I need as I'll have
no proof it exists or its well formatted.
Considering the size of the json data structure of something like "ceph
-s", that is a serious extra-load on _every_ tool that needs to read the
json while we could have share the data structures (like between
ceph-nano & my work).