[tracker/functions] libtracker-db: Add timestamp to transactions in journal



commit 01357793f18571652caf39c2d97e8521d12072bc
Author: Jürg Billeter <j bitron ch>
Date:   Wed Jan 6 17:09:31 2010 +0100

    libtracker-db: Add timestamp to transactions in journal

 src/libtracker-db/tracker-db-journal.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-journal.c b/src/libtracker-db/tracker-db-journal.c
index 9a4786e..10b3c70 100644
--- a/src/libtracker-db/tracker-db-journal.c
+++ b/src/libtracker-db/tracker-db-journal.c
@@ -63,6 +63,7 @@ static struct {
 	const gchar *entry_begin;
 	const gchar *entry_end;
 	guint32 amount_of_triples;
+	time_t time;
 	TrackerDBJournalEntryType type;
 	const gchar *uri;
 	guint32 s_id;
@@ -315,6 +316,11 @@ tracker_db_journal_start_transaction (void)
 	writer.cur_pos = writer.cur_block_len = size;
 	writer.cur_entry_amount = 0;
 
+	/* add timestamp */
+	cur_block_maybe_expand (sizeof (gint32));
+	cur_setnum (writer.cur_block, &writer.cur_pos, time (NULL));
+	writer.cur_block_len += sizeof (gint32);
+
 	return TRUE;
 }
 
@@ -645,6 +651,7 @@ tracker_db_journal_reader_next (GError **error)
 	 *    [size]
 	 *    [amount]
 	 *    [crc]
+	 *    [time]
 	 *    [id id id]
 	 *    [id id string]
 	 *    [id ...]
@@ -738,6 +745,10 @@ tracker_db_journal_reader_next (GError **error)
 			return FALSE;
 		}
 
+		/* Read the timestamp */
+		reader.time = read_uint32 (reader.current);
+		reader.current += 4;
+
 		reader.type = TRACKER_DB_JOURNAL_START_TRANSACTION;
 		return TRUE;
 	} else if (reader.amount_of_triples == 0) {



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