zanshin Notes
zanshin is Lisa Dusseault's
high-level HTTP/DAV API prototype. I've whacked at the current sharing implementation in Chandler (enough to get sharing working on pilikea.osafoundation.org), and these are some thoughts/questions about moving forward.
High-Level API Issues
- Synchronous vs Asynchronous API
The current implementation of zanshin issues network requests synchronously when needed. For example, you can make a call to myResource.isCollection(), and that will do an HTTP PROPFIND request if the Resource instance doesn't know whether it's a collection or not. This in general makes the API pretty simple, but it also means it has the capacity to wedge the app if it's called in the main thread if there are network issues. An asynchronous API would probably fit better with Twisted's reactor/deferred model, at the cost of some complexity to API clients. However, it makes an HTTP pipelining implementation more transparent/seamless.
- Server Dependencies
It might be desirable to put in hooks (maybe only internally) to customize the behaviour for buggy servers.
- Classes vs builtin types
One example: Is it worth having some kind of Request class for http? The builtins are probably more efficient, but tend to gravitate toward unreadable code.
- Customization
- http: The ability to add methods/content types easily.
- XML: Handling new properties/values.
- Callbacks (delegation) vs subclassing.
Practicalities
- How to package zanshin (eg, separate python distribution, the way it is now, part of Chandler itself, or -- eventually -- part of Twisted).
- Underlying http connection layer requirements: auth, cookies, https and hooks for cert handling, hooks for redirect handling, allowing pipelining.
- Which connection layer to sit atop (httplib, twisted.web, twisted.web2).
- Incorporation into Chandler, possibly controlled by a command-line/env switch. (Or a check for module zanshin in site-packages).
- Unit tests currently require slide on the local machine: pje had mentioned tools to help test client code in cases like this.
--
GrantBaillie - 31 Mar 2005