evolution-data-server r8949 - in branches/camel-db-summary/camel: . providers/local
- From: sragavan svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r8949 - in branches/camel-db-summary/camel: . providers/local
- Date: Fri, 6 Jun 2008 15:52:50 +0000 (UTC)
Author: sragavan
Date: Fri Jun 6 15:52:50 2008
New Revision: 8949
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8949&view=rev
Log:
Make local work super cool without deadlocks.
Modified:
branches/camel-db-summary/camel/camel-db.c
branches/camel-db-summary/camel/camel-folder-summary.c
branches/camel-db-summary/camel/providers/local/camel-mbox-summary.c
Modified: branches/camel-db-summary/camel/camel-db.c
==============================================================================
--- branches/camel-db-summary/camel/camel-db.c (original)
+++ branches/camel-db-summary/camel/camel-db.c Fri Jun 6 15:52:50 2008
@@ -370,7 +370,7 @@
ins_query = sqlite3_mprintf ("INSERT INTO folders VALUES ( %Q, %d, %d, %d, %d, %d, %d, %d, %d, %Q ) ",
record->folder_name, record->version,
- record->flags, record->nextuid, 123,
+ record->flags, record->nextuid, record->time,
record->saved_count, record->unread_count,
record->deleted_count, record->junk_count, record->bdata);
Modified: branches/camel-db-summary/camel/camel-folder-summary.c
==============================================================================
--- branches/camel-db-summary/camel/camel-folder-summary.c (original)
+++ branches/camel-db-summary/camel/camel-folder-summary.c Fri Jun 6 15:52:50 2008
@@ -482,13 +482,15 @@
folder_name = s->folder->full_name;
cdb = s->folder->parent_store->cdb;
-
+
+ CAMEL_SUMMARY_UNLOCK(s, ref_lock);
+ CAMEL_SUMMARY_UNLOCK(s, summary_lock);
ret = camel_db_read_message_info_record_with_uid (cdb, folder_name, uid, (gpointer**) &s, camel_read_mir_callback, &ex);
if (ret != 0) {
- CAMEL_SUMMARY_UNLOCK(s, ref_lock);
- CAMEL_SUMMARY_UNLOCK(s, summary_lock);
return NULL;
}
+ CAMEL_SUMMARY_LOCK(s, summary_lock);
+ CAMEL_SUMMARY_LOCK(s, ref_lock);
info = g_hash_table_lookup (s->loaded_infos, uid);
@@ -634,6 +636,32 @@
return ci;
}
+#warning "FIXME: I should have a better LRU algorithm "
+gboolean
+remove_item (char *key, CamelMessageInfo *info, CamelFolderSummary *s)
+{
+ printf("ref %d\t", info->refcount); //camel_message_info_dump (info);
+ if (info->refcount == 1) {
+ /* Noone seems to need it. Why not free it then. */
+ //camel_message_info_free (info);
+ //return TRUE;
+ }
+ return FALSE;
+}
+static gboolean
+remove_cache (CamelFolderSummary *s)
+{
+ struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
+ printf("removing cache... %s %d\n", s->folder->full_name, g_hash_table_size (s->loaded_infos));
+ #warning "hack. fix it"
+ if (g_hash_table_size(s->loaded_infos) == 0)
+ return;
+ CAMEL_SUMMARY_LOCK (s, summary_lock);
+ g_hash_table_foreach_remove (s->loaded_infos, remove_item, s);
+ CAMEL_SUMMARY_UNLOCK (s, summary_lock);
+ printf("done .. now %d\n",g_hash_table_size (s->loaded_infos));
+ return TRUE;
+}
int
camel_folder_summary_load_from_db (CamelFolderSummary *s)
@@ -658,6 +686,8 @@
/* FIXME FOR SANKAR: No need to pass the address of summary here. */
ret = camel_db_read_message_info_records (cdb, folder_name, (gpointer**) &s, camel_read_mir_callback, &ex);
+ #warning "LRU please and not timeouts"
+ //g_timeout_add_seconds (10, remove_cache, s);
return ret;
}
Modified: branches/camel-db-summary/camel/providers/local/camel-mbox-summary.c
==============================================================================
--- branches/camel-db-summary/camel/providers/local/camel-mbox-summary.c (original)
+++ branches/camel-db-summary/camel/providers/local/camel-mbox-summary.c Fri Jun 6 15:52:50 2008
@@ -656,7 +656,7 @@
ret = summary_update(cls, mbs->folder_size, changes, ex);
} else {
d(printf("folder shrank! rebuilding from start\n"));
- ret = summary_update(cls, 0, changes, ex);
+ ret = summary_update(cls, 0, changes, ex);
}
} else {
d(printf("Folder unchanged, do nothing\n"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]