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



commit fe85f42101b3c7cd0eab8ac449d8feb5d005cfa5
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 d0eb2d7..9772243 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;
@@ -314,6 +315,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;
 }
 
@@ -642,6 +648,7 @@ tracker_db_journal_reader_next (GError **error)
 	 *    [size]
 	 *    [amount]
 	 *    [crc]
+	 *    [time]
 	 *    [id id id]
 	 *    [id id string]
 	 *    [id ...]
@@ -735,6 +742,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]