Thursday, March 18, 2010

Introducing Comfy.Couch, a CouchDB API for .NET

WARNING : The work is still in progress.

From the past few days, I have been working on coming up with a nice little .NET Library that one could use with CouchDB. My goal was to stick with the CouchDB API documentation as much as I can so that it would be easier to work with the driver. The library has dependencies on Log4Net and Json.NET libraries.

I tried to be over-smart when picking that name – Comfy.Couch (I meant a comfortable couch to use :)). At the moment, the database API is functionally complete, but you cannot really use it unless you have the Document API which would be coming soon. The reference is at http://wiki.apache.org/couchdb/HTTP_database_API

I made sure I wrote unit tests to cover most part of my code, but I did miss some pieces here and there.

image

So I ended up having 94% of code coverage so far and I will be adding tests soon.

My idea is to first get the complete API in place and then worry about where it has to be tuned. So far, I have not focused on any kind of tuning, which I think could be done. I have thrown in a few asynchronous requests here and there but they are yet to be tested.

1. Creating a database.


CouchDatabaseOperations.Create("databasename"); //validation on database names is pending.


2. Getting database information from the server



ICouchDatabase db = CouchDatabaseOperations.Get("databasename");
CouchDatabaseInfo info = db.Metadata;


3. Deleting the database



//Delete operation uses MaxRetries as 2 since most of the times the first delete request fails on Windows.
CouchDatabaseOperations.Delete("databasename");


While I have successfully completed the rest of the API that is described in the Database API reference at CouchDB website, I just showed how the library could be used in here. The unit tests might be more helpful for you to get started, if you are interested.



Next steps:



  • Upload the sourcecode to comfy.codeplex.com
  • Improvize logging information
  • Work on the Document API
  • Work on the View API
  • Work on the Bulk Document API
  • Run some performance tests and identify the bottlenecks in the driver.
  • Sample Scrum Management tool in Silverlight 4 that uses CouchDB for data backend.

1 comment:

Inventory Management Software said...

Thanks for sharing your post and it was superb .I would like to hear more from you in future too.