9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Eric Van Hensbergen <ericvh@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] 9P writes for directories
Date: Thu, 26 Mar 2009 15:54:39 -0500	[thread overview]
Message-ID: <a4e6962a0903261354p203c9965se4d082a2e7fc8a7b@mail.gmail.com> (raw)
In-Reply-To: <C7722C98-E353-4786-BD23-499706F43148@sun.com>

On Thu, Mar 26, 2009 at 3:23 PM, Roman Shaposhnik <rvs@sun.com> wrote:
> On Mar 26, 2009, at 12:44 PM, Eric Van Hensbergen wrote:
>>
>> On Thu, Mar 26, 2009 at 2:31 PM, Roman Shaposhnik <rvs@sun.com> wrote:
>>>
>>> On Mar 21, 2009, at 12:00 AM, Roman Shaposhnik wrote:
>>>
>>> The story here is that we are building a bunch of RESTful APIs
>>> and my personal preference is to bend HTTP as close to 9P
>>> as I can get (for obvious reasons). Now, the closest match
>>> to "create" would be POST with a metadata payload on a
>>> "subdirectory" URI. But of course, it is not a create at all.
>>> It really is much closer to write on a subdirectory. Hence the
>>> question: is there anything that HTTP makes us lose except
>>> for the transactional nature of create?
>>>
>>
>> So, my understanding is the function of POST to a collection/directory
>> was to create a new entry in the collection where the ID is assigned
>> automatically by the collection. The ID created is typically returned
>> by this operation.
>
> If by ID you mean URI, that would be my current understanding as well.
> Unlike create though, that is guaranteed to create an object in the
> subdirectory
> identified by an ID (fid), the POST can return any URI.

I think we have a semantic mismatch, if ID==URI then ID != FID.  I
don't see where FID's fit in to the REST model (making REST closer to
Op, then 9p)

>
>> This actually sounds more like a (devip style) clone operation to me.
>
> I have thought about that too, but became convinced that POST is more
> like create (or more like write on a subdirectory -- hence the original
> question). With the clone operation it is the *opening* of the clone
> device that provides you with a new fid. In HTTP that would be like getting
> a redirection on GET. Don't you think?
>

Except that Creates give an ID/path for creation instead of receiving
one -- that's the key thing that makes it like clone, the most
important bit being that this sort of mechanism avoids collision.
Whether or not that is critical depends on how you write your app.  I
think the main difference here is you are trying to map HTTP syntax to
9P syntax, and I've been thinking of semantics -- an HTTP POST to a
subdirectory would equal the opening of a clone file (within that
subdirectory), and writing the metadata, a read on that file would
return the ID -- this would be done atomically by the HTTP server to
service the POST not as a set of HTTP routines.  Again - this all
depends on what you are actually trying to do with your app as to
whether or not clone semantics are necessary.  I think the critical
aspect from the REST/CRUD perspective is that the POST has to be
idempotent which I don't think you can guarantee with just create
semantics due to the possibility of collision (but perhaps creates
with collision just fail), not sure if that is "expected" from a REST
perspective, but it is probably legal.

>> Outside of the ID bit, why wouldn't create suffice?
>
> It would (just as Erik pointed out). I guess I was just looking for
> symmetry (if POST is really a write(*), it should translate into write
> independent of whether the URI corresponds to a subdirectory or
> not) and potential pitfalls that made 9P spec disallow writes on
> subdirectories (and since nobody can identify any of those -- I'll
> rest my case and proceed with translating POST into different
> 9P messages depending on the type of the URI).
>

I don't think the symmetry is worth altering the semantics of the
protocol -- its likely more trouble than its worth in the long run.

        -eric



  parent reply	other threads:[~2009-03-26 20:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-21  7:00 Roman Shaposhnik
2009-03-26 19:31 ` Roman Shaposhnik
2009-03-26 19:35   ` erik quanstrom
2009-03-26 19:50     ` Roman Shaposhnik
2009-03-26 19:56       ` erik quanstrom
2009-03-26 19:44   ` Eric Van Hensbergen
2009-03-26 20:23     ` Roman Shaposhnik
2009-03-26 20:52       ` erik quanstrom
2009-03-26 20:54       ` Eric Van Hensbergen [this message]
2009-03-26 22:05         ` Roman Shaposhnik
2009-03-28  1:36           ` Uriel
2009-03-28  4:03             ` Roman Shaposhnik
2009-04-19 16:43             ` Enrico Weigelt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a4e6962a0903261354p203c9965se4d082a2e7fc8a7b@mail.gmail.com \
    --to=ericvh@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).