You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ecouch currently has the database parameters as the authorization
information encoded as application configuration. This means that ecouch
can only be used with a single couchdb instance.
In order to refactor this and allow for new kinds of uses, I am proposing
the following new API. I believe that the old API can still be supported,
perhaps in ecouch_old module namespace?
The basic idea is to use parameterized modules to make API calls much easier.
I'm posting these here to see if there is any public comment or suggestions
before I start this work.
# New ecouch API
## Old API
### Base HTTP Operations
* url_get(Path, Options)
* url_post(Path, Data)
* url_put(Path, Data)
* url_delete(Path, Options)
### Database Operations
* db_create(DBName)
* db_delete(DBName)
* db_list()
* db_info(DBName)
### Document Operations
* doc_create(DBName, Doc)
* doc_create(DBName, DocName?, Doc)
* doc_update(DBName, DocName?, Doc)
* doc_delete(DBName, DocName?, Rev)
* doc_get(DBName, DocName?)
* doc_get(DBName, DocName?, Options)
* doc_get_all(DBName)
* doc_get_all(DBName, Options)
### View Operations
* view_create(ViewName?, Funs) - unimplemented
* view_update(ViewName?, Funs, Rev) - unimplemented
* view_delete(ViewName?, Rev) - unimplemented
* view_get(ViewName?) - unimplemented
* view_get(ViewName?, Rev) - unimplemented
* view_adhoc(DBName, Fun)
* view_adhoc(DBName, Fun, Options)
* view_access(DBName, DesignName?, ViewName?)
* view_access(DBName, DesignName?, ViewName?, Options)
### Bulk Operations
* doc_bulk_create(DBName, DocList?)
* doc_bulk_update(DBName, DocListRev?)
## New API
### Base HTTP Operations
This API will remain unchanged.
### Context Operations
Parameterized modules are used to create server and database specific
contexts to work with.
#### Server Contexts
Get a context with:
ServerCtx? = ecouch:server(Host, Port[, Options])
Context functions:
* DBCtx = ServerCtx:database(DBName)
* ServerCtx:options()
* ServerCtx:list()
* ServerCtx:create(DBName)
* ServerCtx:delete(DBName)
* ServerCtx:info(DBName)
* ServerCtx:replicate(SourceUrl, TargetUrl?)
* ServerCtx:replicate_local(SrcName, TgtName?)
* ServerCtx:replicate_pull(SourceUrl, TgtName?)
* ServerCtx:replicate_push(SrcName, TargetUrl?)
* ServerCtx:stats()
* ServerCtx:stats(Group, Key)
#### Database Contexts
Get a database context with:
DBCtx = ecouch:database(Host, Port, DBName[, Options])
or
DBCtx = ServerCtx:database(DBName)
Database context functions:
* ServerCtx? = DBCtx:server()
* DBCtx:name()
* DBCtx:create(Doc)
* DBCtx:update(Doc)
* DBCtx:delete(DocName, Rev)
* DBCtx:get(DocName[, Options])
* DBCtx:get_attachment(DocName, AttachName?)
* DBCtx:create_attachment(DocName, AttachName?[, Rev]
* DBCtx:delete_attachment(DocName, AttachName?, Rev)
* DBCtx:list([Options])
* DBCtx:info()
* DBCtx:delete()
* DBCtx:create()
* DBCtx:compact()
* DBCtx:copy(DstName[, DestRev?])
* DBCtx:temp_view(Map, Reduce[, Options])
* DBCtx:query(DesignName, ViewName?[, Options])
##### Get Options
* full (boolean)
* revision (string)
* revinfo (boolean)
##### List Options
* descending (boolean)
* startkey (json)
* endkey (json)
* limit (integer)
* include_docs (boolean)
* keys (list of json)
##### Query Options
* key (json)
* startkey (json)
* startkey_docid (string)
* endkey (json)
* endkey_docid (string)
* limit (integer)
* stale (boolean)
* descending (boolean)
* skip (integer)
* group (boolean)
* group_level (integer)
* reduce (boolean)
* include_docs (boolean)
* keys (list of json)
Original issue reported on code.google.com by [email protected] on 21 Apr 2009 at 4:34
The text was updated successfully, but these errors were encountered:
It looks great, but unfortunately seems to have the same limitation. You can
talk to
the couchdb applicationt that is running in the currently Erlang cluster, but
not to
an arbitrary one, much less two arbitrary ones.
It would be nice if we could keep the same API though, so that it was easy to
switch
out one for the other aside from the database setup bit.
Original issue reported on code.google.com by
[email protected]
on 21 Apr 2009 at 4:34The text was updated successfully, but these errors were encountered: