[tracker/binary-log-2: 27/42] libtracker-db: Add timestamp to transactions in journal



commit 9b7527bd6613f5eb0b05e7c2926d4f008b7ce093
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 8316e13..cf32a8e 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;
@@ -313,6 +314,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;
 }
 
@@ -641,6 +647,7 @@ tracker_db_journal_reader_next (GError **error)
 	 *    [size]
 	 *    [amount]
 	 *    [crc]
+	 *    [time]
 	 *    [id id id]
 	 *    [id id string]
 	 *    [id ...]
@@ -734,6 +741,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]