[tracker/sparql-update-delete-id-passing] libtracker-data: Avoid API change for update_buffer_flush and maybe_flush
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/sparql-update-delete-id-passing] libtracker-data: Avoid API change for update_buffer_flush and maybe_flush
- Date: Wed, 23 Mar 2011 15:19:56 +0000 (UTC)
commit e4149ec9a93ca6072f2b5cac7084effa9ec1f04f
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 e4ca7ef..d3e5508 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 2573e40..e83bf02 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -435,7 +435,7 @@ update_property_value (const gchar *ontology_path,
gint subject_id = tracker_data_query_resource_id (subject);
tracker_data_delete_statement (NULL, subject_id, predicate, str, &error);
if (!error)
- tracker_data_update_buffer_flush (TRUE, &error);
+ tracker_data_update_buffer_flush (&error);
}
}
@@ -460,7 +460,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) {
@@ -1295,7 +1295,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 (TRUE, &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 77a3a19..fbcc086 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);
@@ -2990,7 +2992,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);
@@ -3217,7 +3219,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) {
@@ -3238,7 +3240,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);
@@ -3277,7 +3279,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);
@@ -3333,7 +3335,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);
@@ -3384,7 +3386,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 0ea6eeb..4489dcf 100644
--- a/src/libtracker-data/tracker-data-update.h
+++ b/src/libtracker-data/tracker-data-update.h
@@ -86,10 +86,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 f240819..41417a6 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -725,7 +725,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) {
@@ -734,7 +734,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]