[tracker/direct-access: 8/158] tracker-store: Turtle import improvements



commit ae99ba04d5a9b2874b76c8670af23e2d909fc528
Author: Jürg Billeter <j bitron ch>
Date:   Thu Jul 1 16:30:37 2010 +0200

    tracker-store: Turtle import improvements

 src/tracker-store/tracker-events.c |    8 ++++++++
 src/tracker-store/tracker-events.h |    1 +
 src/tracker-store/tracker-store.c  |   11 +++++++++++
 3 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-store/tracker-events.c b/src/tracker-store/tracker-events.c
index ae3064d..583e2bf 100644
--- a/src/tracker-store/tracker-events.c
+++ b/src/tracker-store/tracker-events.c
@@ -144,6 +144,14 @@ tracker_events_reset (void)
 	private->frozen = FALSE;
 }
 
+void
+tracker_events_freeze (void)
+{
+	g_return_if_fail (private != NULL);
+
+	private->frozen = TRUE;
+}
+
 GArray *
 tracker_events_get_pending (void)
 {
diff --git a/src/tracker-store/tracker-events.h b/src/tracker-store/tracker-events.h
index 01629a4..981233c 100644
--- a/src/tracker-store/tracker-events.h
+++ b/src/tracker-store/tracker-events.h
@@ -48,6 +48,7 @@ void       tracker_events_insert      (const gchar              *uri,
                                        TrackerDBusEventsType     type);
 GArray    *tracker_events_get_pending (void);
 void       tracker_events_reset       (void);
+void       tracker_events_freeze      (void);
 
 G_END_DECLS
 
diff --git a/src/tracker-store/tracker-store.c b/src/tracker-store/tracker-store.c
index 91317ab..be276e3 100644
--- a/src/tracker-store/tracker-store.c
+++ b/src/tracker-store/tracker-store.c
@@ -38,6 +38,7 @@
 #include <libtracker-data/tracker-sparql-query.h>
 
 #include "tracker-store.h"
+#include "tracker-events.h"
 
 #define TRACKER_STORE_MAX_CONCURRENT_QUERIES               2
 
@@ -143,9 +144,12 @@ process_turtle_file (TrackerTurtleReader *reader, GError **error)
 {
 	GError *new_error = NULL;
 
+	tracker_events_freeze ();
+
 	tracker_data_begin_transaction (&new_error);
 	if (new_error) {
 		g_propagate_error (error, new_error);
+		tracker_events_reset ();
 		return;
 	}
 
@@ -166,11 +170,15 @@ process_turtle_file (TrackerTurtleReader *reader, GError **error)
 			                                           tracker_turtle_reader_get_object (reader),
 			                                           &new_error);
 		}
+		if (!new_error) {
+			tracker_data_update_buffer_might_flush (&new_error);
+		}
 	}
 
 	if (new_error) {
 		tracker_data_rollback_transaction ();
 		g_propagate_error (error, new_error);
+		tracker_events_reset ();
 		return;
 	}
 
@@ -178,8 +186,11 @@ process_turtle_file (TrackerTurtleReader *reader, GError **error)
 	if (new_error) {
 		tracker_data_rollback_transaction ();
 		g_propagate_error (error, new_error);
+		tracker_events_reset ();
 		return;
 	}
+
+	tracker_events_reset ();
 }
 
 static gboolean



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