listing attributes

Jeff Darcy jdarcy at redhat.com
Mon Feb 21 20:51:36 UTC 2011


On 02/21/2011 01:56 PM, Jim Meyering wrote:
> Maros Zatko reported that this part of notes.txt is not accurate:
> 
> 	GET /bucket/object/attrs
> 		get all attribute names
> 
> I.e., curl -d http://localhost:9091/b1/attr_post/attrs
> does nothing useful.
> 
> However, you *can* make iwhd print all attribute names via
> the undocumented op=parts control code.  For example,
> currently this command:
> 
>     curl -d op=parts http://localhost:9091/b1/attr_post
> 
> prints this:
> 
> <object>
>        <object_body path="http://localhost:9091/b1/attr_post/body"/>
>        <object_attr_list path="http://localhost:9091/b1/attr_post/attrs"/>
>        <object_attr name="shape" path="http:/localhost:9091/b1/attr_post/attr_shape"
>        <object_attr name="size" path="http:/localhost:9091/b1/attr_post/attr_size"
> </object>
> 
> Every one of those URLs is invalid.
> The http://localhost:9091/b1/attr_post/attrs URL is invalid.
> The path= URLs are not valid.
> And the "/body" URL is not valid, either.
> 
> I propose to adjust things so that _attrs (a new, reserved word)
> can be used.  Then, GET'ting say, http://localhost:9091/b1/attr_post/_attrs"
> would yield this output:
> 
> <object>
> ***    <object_body path="http://localhost:9091/b1/attr_post/body"/>
> ***    <object_attr_list path="http://localhost:9091/b1/attr_post/_attrs"/>
>        <object_attr name="shape"
>        <object_attr name="size"
> </object>
> 
> Also, I propose to remove both of the "***"-marked lines.
> The /body one is simply invalid.  Even if it were valid,
> like the other, it is trivially derivable from the original.
> Note that I've removed the path= URLs, too, for the same reason.
> They're easily derivable.
> 
> Please speak up soon if you'd like anything different.

Fine with me, but you might want to check docs/warehouse_api_final.md
first.  That file - not notes.txt - was supposed to be the authoritative
document describing the API, and is where the "invalid"
body/attrs/attr_xxx URLs come from.  The op=parts interface was added as
10c20c718924cdc340cd77f8134a39c27c0027bd on October 6, in response to
commentary about the API (either as defined or as implemented) not being
"REST" enough.  That's the same reason the templates generate the
body/attrs elements and the parts= attributes; the RESTafarians on the
project call that HATEOAS, and "trivially derivable" never satisfied
anyone in that camp before.

Unfortunately, there was little enthusiasm for devoting resources to
completion of the "reconcile dispatch with commands/format above" task
mentioned in notes.txt, so IIRC we agreed to fix in in doc rather than
code.  That would imply:

(1) Leave the dispatch table alone.
(2) Adjust the templates and warehouse_api_final.md to match the
dispatch table.
(3) Remove notes.txt since it (as its name implies) was never meant to
be authoritative anyway and has long since lost any but historical
significance.

Personally, I don't like the op=parts or .../body aspects of the
interface anyway so your proposal (other than the unclosed object_attr
elements) looks fine.  I just want to make sure people understand the
history, which is likely to repeat itself painfully any time the API is
tweaked, before making any decisions.


More information about the iwhd-devel mailing list