[tracker/sparql-update-delete-id-passing: 2/4] libtracker-data: Avoid API change for update_buffer_flush and maybe_flush



commit edeb5cbf2d51967daf6fefc0292fcb1b97ea6b3a
Author: Philip Van Hoof <philip codeminded be>
Date:   Wed Mar 23 16:05:54 2011 +0100

    libtracker-data: Avoid API change for update_buffer_flush and maybe_flush

 src/libtracker-data/libtracker-data.vapi      |    4 +-
 src/libtracker-data/tracker-data-manager.c    |    6 ++--
 src/libtracker-data/tracker-data-update.c     |   30 +++++++++++++-----------
 src/libtracker-data/tracker-data-update.h     |    6 +---
 src/libtracker-data/tracker-sparql-query.vala |    4 +-
 5 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/src/libtracker-data/libtracker-data.vapi b/src/libtracker-data/libtracker-data.vapi
index 0137c1f..c2cd549 100644
--- a/src/libtracker-data/libtracker-data.vapi
+++ b/src/libtracker-data/libtracker-data.vapi
@@ -176,8 +176,8 @@ namespace Tracker {
 		public void insert_statement (string? graph, string subject, string predicate, string object) throws Sparql.Error, DateError;
 		public void insert_statement_with_uri (string? graph, string subject, string predicate, string object) throws Sparql.Error;
 		public void insert_statement_with_string (string? graph, string subject, string predicate, string object) throws Sparql.Error, DateError;
-		public void update_buffer_flush (bool delete_statements = false) throws DBInterfaceError;
-		public void update_buffer_might_flush (bool delete_statements = false) throws DBInterfaceError;
+		public void update_buffer_flush () throws DBInterfaceError;
+		public void update_buffer_might_flush () throws DBInterfaceError;
 		public void sync ();
 
 		public void add_insert_statement_callback (StatementCallback callback);
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index a0a48a9..f59569c 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -434,7 +434,7 @@ update_property_value (const gchar      *ontology_path,
 				if (!unsup_onto_err) {
 					tracker_data_delete_statement (NULL, subject, 0, predicate, str, &error);
 					if (!error)
-						tracker_data_update_buffer_flush (FALSE, &error);
+						tracker_data_update_buffer_flush (&error);
 				}
 			}
 
@@ -459,7 +459,7 @@ update_property_value (const gchar      *ontology_path,
 		                               predicate, object,
 		                               &error);
 		if (!error)
-			tracker_data_update_buffer_flush (FALSE, &error);
+			tracker_data_update_buffer_flush (&error);
 	}
 
 	if (error) {
@@ -1294,7 +1294,7 @@ check_for_deleted_domain_index (TrackerClass *class)
 				g_critical ("Ontology change, %s", error->message);
 				g_clear_error (&error);
 			} else {
-				tracker_data_update_buffer_flush (FALSE, &error);
+				tracker_data_update_buffer_flush (&error);
 				if (error) {
 					g_critical ("Ontology change, %s", error->message);
 					g_clear_error (&error);
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 9a1bb03..3375972 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -990,13 +990,13 @@ static void resource_buffer_free (TrackerDataUpdateBufferResource *resource)
 }
 
 void
-tracker_data_update_buffer_flush (gboolean   delete_statements,
-                                  GError   **error)
+tracker_data_update_buffer_flush (GError   **error)
 {
 	GHashTableIter iter;
 	GError *actual_error = NULL;
 
-	if (in_journal_replay || delete_statements) {
+	if (update_buffer.resources_by_id) {
+		/* For in_journal_replay and delete_statement */
 		g_hash_table_iter_init (&iter, update_buffer.resources_by_id);
 		while (g_hash_table_iter_next (&iter, NULL, (gpointer*) &resource_buffer)) {
 			tracker_data_resource_buffer_flush (&actual_error);
@@ -1007,7 +1007,9 @@ tracker_data_update_buffer_flush (gboolean   delete_statements,
 		}
 
 		g_hash_table_remove_all (update_buffer.resources_by_id);
-	} else {
+	}
+
+	if (update_buffer.resources) {
 		g_hash_table_iter_init (&iter, update_buffer.resources);
 		while (g_hash_table_iter_next (&iter, NULL, (gpointer*) &resource_buffer)) {
 			tracker_data_resource_buffer_flush (&actual_error);
@@ -1019,17 +1021,17 @@ tracker_data_update_buffer_flush (gboolean   delete_statements,
 
 		g_hash_table_remove_all (update_buffer.resources);
 	}
+
 	resource_buffer = NULL;
 }
 
 void
-tracker_data_update_buffer_might_flush (gboolean   delete_statements,
-                                        GError   **error)
+tracker_data_update_buffer_might_flush (GError   **error)
 {
 	/* avoid high memory usage by update buffer */
 	if (g_hash_table_size (update_buffer.resources) +
 	    g_hash_table_size (update_buffer.resources_by_id) >= 1000) {
-		tracker_data_update_buffer_flush (delete_statements, error);
+		tracker_data_update_buffer_flush (error);
 	}
 }
 
@@ -2075,7 +2077,7 @@ resource_buffer_switch (const gchar *graph,
 		/* large INSERTs with thousands of resources could lead to
 		   high peak memory usage due to the update buffer
 		   flush the buffer if it already contains 1000 resources */
-		tracker_data_update_buffer_might_flush (in_delete_statement, NULL);
+		tracker_data_update_buffer_might_flush (NULL);
 
 		/* subject not yet in cache, retrieve or create ID */
 		resource_buffer = g_slice_new0 (TrackerDataUpdateBufferResource);
@@ -2995,7 +2997,7 @@ tracker_data_commit_transaction (GError **error)
 
 	iface = tracker_db_manager_get_db_interface ();
 
-	tracker_data_update_buffer_flush (FALSE, &actual_error);
+	tracker_data_update_buffer_flush (&actual_error);
 	if (actual_error) {
 		tracker_data_rollback_transaction ();
 		g_propagate_error (error, actual_error);
@@ -3222,7 +3224,7 @@ tracker_data_replay_journal (TrackerBusyCallback   busy_callback,
 			tracker_data_begin_transaction_for_replay (tracker_db_journal_reader_get_time (), NULL);
 		} else if (type == TRACKER_DB_JOURNAL_END_TRANSACTION) {
 			GError *new_error = NULL;
-			tracker_data_update_buffer_might_flush (FALSE, &new_error);
+			tracker_data_update_buffer_might_flush (&new_error);
 
 			tracker_data_commit_transaction (&new_error);
 			if (new_error) {
@@ -3243,7 +3245,7 @@ tracker_data_replay_journal (TrackerBusyCallback   busy_callback,
 			tracker_db_journal_reader_get_statement (&graph_id, &subject_id, &predicate_id, &object);
 
 			if (last_operation_type == -1) {
-				tracker_data_update_buffer_flush (FALSE, &new_error);
+				tracker_data_update_buffer_flush (&new_error);
 				if (new_error) {
 					g_warning ("Journal replay error: '%s'", new_error->message);
 					g_clear_error (&new_error);
@@ -3282,7 +3284,7 @@ tracker_data_replay_journal (TrackerBusyCallback   busy_callback,
 			tracker_db_journal_reader_get_statement_id (&graph_id, &subject_id, &predicate_id, &object_id);
 
 			if (last_operation_type == -1) {
-				tracker_data_update_buffer_flush (FALSE, &new_error);
+				tracker_data_update_buffer_flush (&new_error);
 				if (new_error) {
 					g_warning ("Journal replay error: '%s'", new_error->message);
 					g_clear_error (&new_error);
@@ -3338,7 +3340,7 @@ tracker_data_replay_journal (TrackerBusyCallback   busy_callback,
 			tracker_db_journal_reader_get_statement (&graph_id, &subject_id, &predicate_id, &object);
 
 			if (last_operation_type == 1) {
-				tracker_data_update_buffer_flush (FALSE, &new_error);
+				tracker_data_update_buffer_flush (&new_error);
 				if (new_error) {
 					g_warning ("Journal replay error: '%s'", new_error->message);
 					g_clear_error (&new_error);
@@ -3389,7 +3391,7 @@ tracker_data_replay_journal (TrackerBusyCallback   busy_callback,
 			tracker_db_journal_reader_get_statement_id (&graph_id, &subject_id, &predicate_id, &object_id);
 
 			if (last_operation_type == 1) {
-				tracker_data_update_buffer_flush (FALSE, &new_error);
+				tracker_data_update_buffer_flush (&new_error);
 				if (new_error) {
 					g_warning ("Journal replay error: '%s'", new_error->message);
 					g_clear_error (&new_error);
diff --git a/src/libtracker-data/tracker-data-update.h b/src/libtracker-data/tracker-data-update.h
index 9da1a88..77011e4 100644
--- a/src/libtracker-data/tracker-data-update.h
+++ b/src/libtracker-data/tracker-data-update.h
@@ -87,10 +87,8 @@ void     tracker_data_update_sparql                 (const gchar               *
 GVariant *
          tracker_data_update_sparql_blank           (const gchar               *update,
                                                      GError                   **error);
-void     tracker_data_update_buffer_flush           (gboolean                   delete_statements,
-                                                     GError                   **error);
-void     tracker_data_update_buffer_might_flush     (gboolean                   delete_statements,
-                                                     GError                   **error);
+void     tracker_data_update_buffer_flush           (GError                   **error);
+void     tracker_data_update_buffer_might_flush     (GError                   **error);
 void     tracker_data_load_turtle_file              (GFile                     *file,
                                                      GError                   **error);
 
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index d55fae6..82613f8 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -715,7 +715,7 @@ public class Tracker.Sparql.Query : Object {
 				update_blank_nodes.add_value (blank_nodes);
 			}
 
-			Data.update_buffer_might_flush (delete_statements);
+			Data.update_buffer_might_flush ();
 		}
 
 		if (!data) {
@@ -724,7 +724,7 @@ public class Tracker.Sparql.Query : Object {
 		}
 
 		// ensure possible WHERE clause in next part gets the correct results
-		Data.update_buffer_flush (delete_statements);
+		Data.update_buffer_flush ();
 		bindings = null;
 
 		context = context.parent_context;



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