A prerequisite for partitioning and a general nice-to-have feature is an Erlang API for CouchDB. Let's get the discussion going; I'd love to see an initial version of the API included with the 0.10 release.
The API will overlap quite a bit with the code in couch_http_db.erl, couch_http_view.erl, etc. I propose refactoring this code into the Erlang API methods and having the couch_http_*.erl files use the Erlang API. This helps us reduce code duplication and will allow us to test the Erlang API with the existing HTTP tests. For the initial version of the API, I'd prefer to only expose a subset of the HTTP API. Document CRUD methods are an obvious one and at least a basic form of view queries would be nice. The Erlang API needs to be just as stable, if not more stable, than the HTTP API - I'm open to implementing more or less pending reasonable discussion. The parameters passed in and data returned from the API should be well-defined. I propose any complex data structures given as input or returned from the API be records defined in couch_db.hrl or another appropriate place. There are already records defined here for documents and view query arguments, which might be all we need. This should be enough to spark an initial discussion. I'll create a page on the wiki for the API proposal to consolidate some of the information once other people give their input. Thanks, Ben
