2014-11-17 18:58 GMT+01:00 Matthew Ahrens <[email protected]>:
> On Mon, Nov 17, 2014 at 9:39 AM, Goulven Riou <[email protected]>
> wrote:
>
>>
>> Hi Matt,
>> thanks for your comments on the pull request
>> we have corrected the style error and applied your suggestions.
>>
>> Regarding the dataset name as a key,
>> the json are consumed by some code and we don't know in advance what key
>> name
>> that we will have, so list is preferable to iter over json structure,
>>
>
> Is it not possible / convenient to iterate over the key/value pairs in a
> JSON structure
>
Actually it s possible to iterate over key in a json dictionnary, but key
should stay a key and value a value :) , when your "zfs list -o name"
display :
root@t0 # zfs list -o name,used,refer
NAME USED REFER
rpool 1.63G 404M
rpool/ROOT 1.23G 144K
rpool/ROOT/debian 1.23G 1.23G
the key are NAME, and value are "rpool', and so on
the json output :
"rpool" : {
"USED" : "1.63G",
"REFER" : "404M"
}
is not good json format (rpool is the value and you have to know the key to
get the structure which is not convenient -> you have to fetch key name in
advance)
the good format is (what we have implemented):
{
"NAME" : "rpool",
"USED" : "1.63G",
"REFER" : "404M"
}
if you want the structure of a specified pool, you must specify it in the
command as :
"zfs list <pool name>"
> could you explain the use case where you need dataset as key name ?
>>
>
>> an other question about the -o option , did you want to block the -o
>> option with the -J option ?
>>
>
> I thought the whole point was to use -J with -o. Without -o, you will get
> whatever the default properties are, which could conceivably change over
> time.
>
>
it's already the case in our implementation.
> --matt
>
>
>> best regards
>> Goulven
>>
>
Regards,
Francois
_______________________________________________
developer mailing list
[email protected]
http://lists.open-zfs.org/mailman/listinfo/developer