[tahoe-lafs-trac-stream] [tahoe-lafs] #2041: Improve JSON layout
tahoe-lafs
trac at tahoe-lafs.org
Sat Jul 27 23:47:25 UTC 2013
#2041: Improve JSON layout
------------------------+------------------------
Reporter: markberger | Owner: daira
Type: defect | Status: new
Priority: minor | Milestone: 2.0.0
Component: unknown | Version: 1.10.0
Keywords: http | Launchpad Bug:
------------------------+------------------------
I've been playing around with the web api and navigating the JSON is
unnecessarily complicated. For example, this is what I get when I request
info on one dirnode:
{{{
[
"dirnode",
{
"rw_uri": "URI:DIR2:5bbr...",
"verify_uri": "URI:DIR2-Verifier:or4r...",
"ro_uri": "URI:DIR2-RO:4z4rlm...",
"children": {
"file-1": [
"filenode",
{
"format": "CHK",
"verify_uri": "URI:CHK-Verifier:6vwhe...",
"ro_uri": "URI:CHK:ncwvkn...",
"mutable": false,
"size": 73,
"metadata": {
"tahoe": {
"linkmotime": 1374966798.767442,
"linkcrtime": 1374966798.767442
}
}
}
],
"file-2": [
"filenode",
{
"format": "CHK",
"verify_uri": "URI:CHK-Verifier:vqtq4...",
"ro_uri": "URI:CHK:3rbo...",
"mutable": false,
"size": 396,
"metadata": {
"tahoe": {
"linkmotime": 1374966841.575218,
"linkcrtime": 1374966841.575218
}
}
}
]
},
"mutable": true
}
]
}}}
It doesn't make sense to return a list when I'm requesting info on one
directory. The "dirnode" element does not need to preface the map and
could instead be the info associated with a {{{ type }}} key. This isn't a
huge inconvenience, but it makes the children unnecessarily complicated as
well. Children should be a map that returns another map.
Also I don't think creating another dictionary for metadata adds any
clarity or convenience.
These issues aren't a big deal when you're working with the api in Python
or another dynamically typed language, but for statically typed languages
this format is painful to parse.
--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2041>
tahoe-lafs <https://tahoe-lafs.org>
secure decentralized storage
More information about the tahoe-lafs-trac-stream
mailing list