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



commit 84d9481821b38a1f8163bee5ae63a2dc8fe0a492
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 def2e82..8f287b0 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;
 }
 
@@ -643,6 +649,7 @@ tracker_db_journal_reader_next (GError **error)
 	 *    [size]
 	 *    [amount]
 	 *    [crc]
+	 *    [time]
 	 *    [id id id]
 	 *    [id id string]
 	 *    [id ...]
@@ -736,6 +743,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]