[evolution-couchdb] Retrieve all documents from CouchDB in 1 HTTP request



commit 1d76f34f7a0a0795cead1a24224a567afada0385
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Tue May 4 18:29:42 2010 +0200

    Retrieve all documents from CouchDB in 1 HTTP request

 addressbook/e-book-backend-couchdb.c |   20 ++++----------------
 1 files changed, 4 insertions(+), 16 deletions(-)
---
diff --git a/addressbook/e-book-backend-couchdb.c b/addressbook/e-book-backend-couchdb.c
index 8321fb5..0d994cb 100644
--- a/addressbook/e-book-backend-couchdb.c
+++ b/addressbook/e-book-backend-couchdb.c
@@ -1039,30 +1039,18 @@ e_book_backend_couchdb_load_source (EBookBackend *backend,
 	/* Populate the cache */
 	e_file_cache_clean (E_FILE_CACHE (couchdb_backend->cache));
 	error = NULL;
-	doc_list = couchdb_session_list_documents (couchdb_backend->couchdb,
-						   couchdb_backend->dbname,
-						   &error);
+	doc_list = couchdb_session_get_all_documents (couchdb_backend->couchdb,
+						      couchdb_backend->dbname,
+						      &error);
 	for (sl = doc_list; sl != NULL; sl = sl->next) {
 		EContact *contact;
-		CouchdbDocument *document;
-		CouchdbDocumentInfo *doc_info = (CouchdbDocumentInfo *) sl->data;
-
-		/* Retrieve this document */
-		error = NULL;
-		document = couchdb_document_get (couchdb_backend->couchdb,
-						 couchdb_backend->dbname,
-						 couchdb_document_info_get_docid (doc_info),
-						 &error);
-		if (!document)
-			continue;
+		CouchdbDocument *document = COUCHDB_DOCUMENT (sl->data);
 
 		contact = contact_from_couch_document (document);
 		if (contact != NULL) {
 			e_book_backend_cache_add_contact (couchdb_backend->cache, contact);
 			g_object_unref (G_OBJECT (contact));
 		}
-
-		g_object_unref (G_OBJECT (document));
 	}
 
 	couchdb_session_free_document_list (doc_list);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]