[ostree] deltas: Add a timestamp to delta metadata



commit 60c4d467aa3a5500d77f0255b65d9c13a818e32d
Author: Colin Walters <walters verbum org>
Date:   Mon Feb 10 08:29:00 2014 -0500

    deltas: Add a timestamp to delta metadata

 .../ostree-repo-static-delta-compilation.c         |   13 +++++++++----
 src/libostree/ostree-repo-static-delta-core.c      |    2 +-
 src/libostree/ostree-repo-static-delta-private.h   |    3 ++-
 3 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/src/libostree/ostree-repo-static-delta-compilation.c 
b/src/libostree/ostree-repo-static-delta-compilation.c
index cfcf1f4..722b9bb 100644
--- a/src/libostree/ostree-repo-static-delta-compilation.c
+++ b/src/libostree/ostree-repo-static-delta-compilation.c
@@ -365,10 +365,15 @@ ostree_repo_static_delta_generate (OstreeRepo                   *self,
       metadata_source = tmp_metadata;
     }
 
-  delta_descriptor = g_variant_new ("(@(a(ss)a(say))aya(ayttay))",
-                                    metadata_source,
-                                    g_variant_builder_new (G_VARIANT_TYPE ("ay")),
-                                    part_headers);
+  {
+    GDateTime *now = g_date_time_new_now_utc ();
+    delta_descriptor = g_variant_new ("(@(a(ss)a(say))taya" OSTREE_STATIC_DELTA_META_ENTRY_FORMAT ")",
+                                      metadata_source,
+                                      GUINT64_TO_BE (g_date_time_to_unix (now)),
+                                      g_variant_builder_new (G_VARIANT_TYPE ("ay")),
+                                      part_headers);
+    g_date_time_unref (now);
+  }
 
   if (!ot_util_variant_save (descriptor_path, delta_descriptor, cancellable, error))
     goto out;
diff --git a/src/libostree/ostree-repo-static-delta-core.c b/src/libostree/ostree-repo-static-delta-core.c
index 3cd706e..dad5fdb 100644
--- a/src/libostree/ostree-repo-static-delta-core.c
+++ b/src/libostree/ostree-repo-static-delta-core.c
@@ -215,7 +215,7 @@ ostree_repo_static_delta_execute_offline (OstreeRepo                    *self,
                             FALSE, &meta, error))
     goto out;
 
-  headers = g_variant_get_child_value (meta, 2);
+  headers = g_variant_get_child_value (meta, 3);
   n = g_variant_n_children (headers);
   for (i = 0; i < n; i++)
     {
diff --git a/src/libostree/ostree-repo-static-delta-private.h 
b/src/libostree/ostree-repo-static-delta-private.h
index 772a501..a5ad37c 100644
--- a/src/libostree/ostree-repo-static-delta-private.h
+++ b/src/libostree/ostree-repo-static-delta-private.h
@@ -59,6 +59,7 @@ G_BEGIN_DECLS
  *
  * delta-descriptor:
  *   metadata: a{sv}
+ *   timestamp: guint64
  *   ARRAY[(csum from, csum to)]: ay
  *   ARRAY[delta-part-header]
  *
@@ -70,7 +71,7 @@ G_BEGIN_DECLS
  * recursion mechanism that would potentially allow saving significant
  * storage space on the server.
  */ 
-#define OSTREE_STATIC_DELTA_META_FORMAT "(a{sv}aya" OSTREE_STATIC_DELTA_META_ENTRY_FORMAT ")"
+#define OSTREE_STATIC_DELTA_META_FORMAT "(a{sv}taya" OSTREE_STATIC_DELTA_META_ENTRY_FORMAT ")"
 
 gboolean _ostree_static_delta_part_execute (OstreeRepo      *repo,
                                             GVariant        *header,


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