Eugene Eric Kim [eekim@blueoxen.com] said: (01)
> > I'd like to see the PurpleWiki::Sequence stuff removed from
> > PurpleWiki and made standalone. You could then get purple
> > numbers through a library interface, RPC interface, or web
> > services interface.
>
> Do you have suggestions on what steps need to be taken and what the
> APIs should look like? (02)
I gave some thought to this a while ago, but I don't quite
recall what I came up with. Luckily though, I wrote some
code that never saw the light of day: (03)
http://panacea.canonical.org/~matthew/purple-number.tar.gz (04)
Looking over that code it doesn't appear I had much of an
idea at all. I conflated tagging, naming, and versioning in
my code. I also didn't abstract the storage mechanism. Ah
well, lack of direction and vision is probably why I left it
to collect dust. (05)
> * Make PurpleWiki::Sequence its own package. This is easy. (06)
Yeah, I agree. Although I would stay away from PurpleWiki
as a namespace. It's more generic than that. (07)
> * Abstract it to support multiple backends. I'd like a MySQL
> backend, for example. (08)
Yeah, that would be nice but it is not so important as a
first step. It's important in the abstract sense of "I want
to build good software" but not in the more pragmatic sense
of "I want to purple number something right now." (09)
I think a more important first step is solidifying the
behavior of the library from the point of view of its
clients. I think the behavior of Purple::Sequence is fairly
well defined as it is and I that it would work well enough. (010)
I'd describe Purple::Sequence's current interface as follows
(in REST-speak): (011)
a) GET a URI associated with a nid. # getURL()
b) POST a URI and get back a nid. # getNext() / updateURL()
c) POST a URI to a nid to update it. # updateURL() (012)
The "getNext" method of Purple::Sequence is just (b) with
the empty string for a URI. (013)
So, in practice, something like: (014)
a) req: GET http://purplespace.net/nids/AxYz0
rep: 302 FOUND http://i.love.eekim.net/papers/how2dance.html#AxYz0 (015)
b) req: POST http://purplespace.net/nids/
uri=http://i.love.eekim.net/papers/how2dance.html
rep: 200 OK
<nid xlink="...above uri...">AxYz0</nid>
...or whatever doesn't have to be XML... (016)
c) req: POST http://purplespace.net/nids/AxYz0
uri=http://i.love.eekim.net/papers/how2dance.html#AxYz0
rep: 200 OK
<nid xlink="...above uri...">AxYz0</nid> (017)
Something like the above is what I see as a good start for
the behavior of a sequencing library/service. (018)
> * Clean up the API. There are a lot of new methods that Gerry added
> to handle proper updating of URL -> NID mappings. I suspect
> there's some consolidation and cleaning up that can happen. (019)
I haven't studied the code since before Gerry touched it.
I'd imagine starting over clean though. It's a fairly
simple program to write. (020)
So, continuing on beyond your email, I would say the steps
are as follows: (021)
1) decided on an interface to the library (easy)
2) write just enough code to make it go (moderate)
3) expose it somehow (command line program, daemon, RPC,
web services, whatever) (moderate/difficult)
4) convert everything that uses purple numbers to use
it. Arts, Perplog, PurpleWiki, RT, Mailman, Chris's
Kwiki experiments, etc. (tedious)
5) Rejoice in our new purple master. (rapture) (022)
Of course (4) is the real bitch but not so hard as it is
tedious. (023)
After that one can go back and do more advanced things: (024)
1) abstract storage engines
2) something as purple numbers other than [a-z0-9]
3) complexicate the interface
4) etc (025)
That's all I have in me right now. On a completely
unrelated note, you should read Kragen's thoughts on Queer
Numbers: (026)
http://www.bentwookie.org/blog/kragen-tol/2005-October/000796.html (027)
-matthew (028)
--
This message is archived at: (029)
http://purplewiki.blueoxen.net/forums/cgi-bin/mesg.cgi?a=devel&i=20051012183815.GA10914@canonical.org (030)
|