IWHD API Suggestions

Martyn Taylor mtaylor at redhat.com
Mon Sep 12 16:08:43 UTC 2011


On 09/10/2011 12:19 AM, Pete Zaitcev wrote:
> On Tue, 06 Sep 2011 16:42:26 +0100
> Martyn Taylor<mtaylor at redhat.com>  wrote:
>
>> We [the aeolus team] hope that IWHD can provide a typical RESTful API, so that
>> we can consume it using  standard libraries that consume REST interfaces.
> I looked at ActiveResource gem, but it proved to be a bridge too far
> for me. So, I'm going to run down the bullet points, fill out with
> what I understood of them with examples.
>
>> 1) XML Element Tags
> I think this is asking for something like a typed bucket. Martyn's
> example was this:
>
> <images>
>      <image>
>          <bucket>images</bucket>
>          <key>....
>      </image>
>
> This only makes sense if we have every bucket returning its own typed list:
>
> curl http://lembas:9090/builds/
> <builds>
>     <build>
>        <bucket>builds</bucket>
>        <key>....
>        ..........<!-- any other weird attributes? -->
>
> One problem with this is that bucket in iwhd have no attributes. So,
> I cannot add a type to a bucket by using a magic attribute _type.
> Admittedly, I was thinking about adding something like that for permissions,
> but I have no idea how difficult it is.
>
> I would like Aeolus team reconsider this. Maybe trick the ActiveResource
> by specifying a type somehow.
>
>> 2) REST Metadata Tags
>> 3) Discoverable API
> Here I am thinking we should start smaller, first with this:
>
> curl http://lembas:9090/images/
> <objects>
>      <object href="/images/dummy_img_2">
>          <bucket>images</bucket>
>          <key>dummy_img_2</key>
>          <link rel="attributes" href="/imags/dummy_img_2/_attrs"/>
>      </object>
>
> This way at least everything is discoverable and we have some attributes
> pointing to every bit of the API, so you never need doing path
> concatenation. It may be not quite in line with the recommendations
> of Geert, but at least it's compatible.
>
> Please let me know if this works. However, if it is not sufficient to get
> ActiveResource useful with iwhd, then it makes no sense to even start.
> In that case, I'd like to see some more examples of what would work,
> so we can hash out something workable, please.

Hi Pete,

Thanks for taking the time to investigate this further.

I think what you have got down there is a good start, though I would 
hesitate to make any progression on this unless we do the full set of 
changes.  Since without us being able to use a REST library (doesn't 
have to be ActiveResources) we're not really going to benefit here.  In 
fact it will actually cause us more work since we will have to change 
our current client.

I can see your issue with buckets and types.  From what I have learned 
over this discussion is that iwhd is simply an object store.  It is 
simply used by imagefactory and conductor and has no ties to either.  
Which has helped me to understand the problem a little more.

So, I do not think that any application code should be changed, but this 
should be handled in an "API transform layer" for want of a better 
word.  A RESTful interface deals with RESTful resources which have a 
type.  So to offer any RESTful interface we need to assign type to 
resources.  In the context of this REST API could we need to create 
resources with types that represents objects in a particular bucket, 
could we not assume that the type is based on the bucket name?  i.e. 
objects in bucket a bucket named "image", are of type "image"?
>
>> 4) Relationships
>> It would be extremely beneficial to us, if iwhd stored two way
>> relations, so that parent objects had a list of its children, as well as
>> the child containing the parent object.
> This looks like something is being discussed still.
I can see some comments by Jim, that may help improve effeciency, but 
they do not address what implications this makes in a RESTful 
environment.  After a little more reading and looking at other REST 
APIs.  I see that relations are in fact listed in both directions.

I see that Jim listed some work done by Michal Fojtik for graph 
traversing iwhd.  I have not had a chance to look at this just yet, it 
may be that this solves some of these issues.

Thanks alot

Martyn
>
> -- P
> _______________________________________________
> aeolus-devel mailing list
> aeolus-devel at lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/aeolus-devel



More information about the iwhd-devel mailing list