[tracker/transient] libtracker-data: Don't journal and don't tracker:modified transient properties
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/transient] libtracker-data: Don't journal and don't tracker:modified transient properties
- Date: Tue, 23 Nov 2010 10:59:31 +0000 (UTC)
commit a5fd63ed3423b6ce05e3056500cc640a52a1f4d9
Author: Philip Van Hoof <philip codeminded be>
Date: Tue Nov 23 11:59:02 2010 +0100
libtracker-data: Don't journal and don't tracker:modified transient properties
src/libtracker-data/tracker-data-update.c | 62 +++++++++++++++-------------
1 files changed, 33 insertions(+), 29 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index b032eb6..00d137c 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -1778,10 +1778,11 @@ cache_delete_resource_type (TrackerClass *class,
}
static void
-resource_buffer_switch (const gchar *graph,
- gint graph_id,
- const gchar *subject,
- gint subject_id)
+resource_buffer_switch (const gchar *graph,
+ gint graph_id,
+ const gchar *subject,
+ gint subject_id,
+ TrackerProperty *property)
{
if (in_journal_replay) {
/* journal replay only provides subject id
@@ -1809,6 +1810,7 @@ resource_buffer_switch (const gchar *graph,
/* subject not yet in cache, retrieve or create ID */
resource_buffer = g_slice_new0 (TrackerDataUpdateBufferResource);
+
if (subject != NULL) {
subject_dup = g_strdup (subject);
resource_buffer->subject = subject_dup;
@@ -1839,13 +1841,13 @@ resource_buffer_switch (const gchar *graph,
}
}
-if (FALSE) {
- g_value_init (&gvalue, G_TYPE_INT64);
- g_value_set_int64 (&gvalue, tracker_data_update_get_next_modseq ());
- cache_insert_value ("rdfs:Resource", "tracker:modified", &gvalue,
- 0,
- FALSE, FALSE, FALSE);
-}
+ if (!property || !tracker_property_get_transient (property)) {
+ g_value_init (&gvalue, G_TYPE_INT64);
+ g_value_set_int64 (&gvalue, tracker_data_update_get_next_modseq ());
+ cache_insert_value ("rdfs:Resource", "tracker:modified", &gvalue,
+ 0,
+ FALSE, FALSE, FALSE);
+ }
}
}
@@ -1873,12 +1875,14 @@ tracker_data_delete_statement (const gchar *graph,
return;
}
- resource_buffer_switch (graph, 0, subject, subject_id);
+ field = tracker_ontologies_get_property_by_uri (predicate);
+
+ resource_buffer_switch (graph, 0, subject, subject_id, field);
if (object && g_strcmp0 (predicate, RDF_PREFIX "type") == 0) {
class = tracker_ontologies_get_class_by_uri (object);
if (class != NULL) {
- if (!in_journal_replay) {
+ if (!in_journal_replay && !tracker_property_get_transient (field)) {
tracker_db_journal_append_delete_statement_id (
(graph != NULL ? query_resource_id (graph) : 0),
resource_buffer->id,
@@ -1894,10 +1898,9 @@ tracker_data_delete_statement (const gchar *graph,
gint pred_id = 0, graph_id = 0, object_id = 0;
gboolean tried = FALSE;
- field = tracker_ontologies_get_property_by_uri (predicate);
if (field != NULL) {
change = delete_metadata_decomposed (field, object, 0, error);
- if (!in_journal_replay && change) {
+ if (!in_journal_replay && change && !tracker_property_get_transient (field)) {
if (tracker_property_get_data_type (field) == TRACKER_PROPERTY_TYPE_RESOURCE) {
pred_id = tracker_property_get_id (field);
@@ -1956,6 +1959,7 @@ static gboolean
tracker_data_insert_statement_common (const gchar *graph,
const gchar *subject,
const gchar *predicate,
+ TrackerProperty *property,
const gchar *object,
GError **error)
{
@@ -1997,7 +2001,7 @@ tracker_data_insert_statement_common (const gchar *graph,
return FALSE;
}
- resource_buffer_switch (graph, 0, subject, 0);
+ resource_buffer_switch (graph, 0, subject, 0, property);
return TRUE;
}
@@ -2098,7 +2102,7 @@ tracker_data_insert_statement_with_uri (const gchar *graph,
}
}
- if (!tracker_data_insert_statement_common (graph, subject, predicate, object, &actual_error)) {
+ if (!tracker_data_insert_statement_common (graph, subject, predicate, property, object, &actual_error)) {
if (actual_error) {
g_propagate_error (error, actual_error);
return;
@@ -2119,7 +2123,7 @@ tracker_data_insert_statement_with_uri (const gchar *graph,
return;
}
- if (!in_journal_replay) {
+ if (!in_journal_replay && !tracker_property_get_transient (property)) {
graph_id = (graph != NULL ? query_resource_id (graph) : 0);
final_prop_id = (prop_id != 0) ? prop_id : tracker_data_query_resource_id (predicate);
object_id = query_resource_id (object);
@@ -2156,12 +2160,12 @@ tracker_data_insert_statement_with_uri (const gchar *graph,
}
- if (!in_journal_replay && change) {
+ if (!in_journal_replay && change && !tracker_property_get_transient (property)) {
tracker_db_journal_append_insert_statement_id (
- (graph != NULL ? query_resource_id (graph) : 0),
- resource_buffer->id,
- final_prop_id,
- object_id);
+ (graph != NULL ? query_resource_id (graph) : 0),
+ resource_buffer->id,
+ final_prop_id,
+ object_id);
}
}
@@ -2197,7 +2201,7 @@ tracker_data_insert_statement_with_string (const gchar *graph,
pred_id = tracker_property_get_id (property);
}
- if (!tracker_data_insert_statement_common (graph, subject, predicate, object, &actual_error)) {
+ if (!tracker_data_insert_statement_common (graph, subject, predicate, property, object, &actual_error)) {
if (actual_error) {
g_propagate_error (error, actual_error);
return;
@@ -2232,7 +2236,7 @@ tracker_data_insert_statement_with_string (const gchar *graph,
}
}
- if (!in_journal_replay && change) {
+ if (!in_journal_replay && change && !tracker_property_get_transient (property)) {
if (!tried) {
graph_id = (graph != NULL ? query_resource_id (graph) : 0);
pred_id = (pred_id != 0) ? pred_id : tracker_data_query_resource_id (predicate);
@@ -2800,7 +2804,7 @@ tracker_data_replay_journal (TrackerBusyCallback busy_callback,
}
if (property) {
- resource_buffer_switch (NULL, graph_id, NULL, subject_id);
+ resource_buffer_switch (NULL, graph_id, NULL, subject_id, NULL);
cache_set_metadata_decomposed (property, object, 0, NULL, graph_id, &new_error);
@@ -2838,7 +2842,7 @@ tracker_data_replay_journal (TrackerBusyCallback busy_callback,
if (tracker_property_get_data_type (property) != TRACKER_PROPERTY_TYPE_RESOURCE) {
g_warning ("Journal replay error: 'property with ID %d does not account URIs'", predicate_id);
} else {
- resource_buffer_switch (NULL, graph_id, NULL, subject_id);
+ resource_buffer_switch (NULL, graph_id, NULL, subject_id, NULL);
if (property == rdf_type) {
uri = tracker_ontologies_get_uri_by_id (object_id);
@@ -2881,7 +2885,7 @@ tracker_data_replay_journal (TrackerBusyCallback busy_callback,
}
last_operation_type = -1;
- resource_buffer_switch (NULL, graph_id, NULL, subject_id);
+ resource_buffer_switch (NULL, graph_id, NULL, subject_id, NULL);
uri = tracker_ontologies_get_uri_by_id (predicate_id);
if (uri) {
@@ -2939,7 +2943,7 @@ tracker_data_replay_journal (TrackerBusyCallback busy_callback,
if (property) {
- resource_buffer_switch (NULL, graph_id, NULL, subject_id);
+ resource_buffer_switch (NULL, graph_id, NULL, subject_id, NULL);
if (property == rdf_type) {
uri = tracker_ontologies_get_uri_by_id (object_id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]