[ostree/wip/delta2: 21/21] deltas: Put deltas in a checksum-prefixed subdirectory
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree/wip/delta2: 21/21] deltas: Put deltas in a checksum-prefixed subdirectory
- Date: Sun, 4 May 2014 20:56:30 +0000 (UTC)
commit be41ce07154523f9938cd0e2482461f3040abb2c
Author: Colin Walters <walters verbum org>
Date: Sun May 4 16:32:37 2014 -0400
deltas: Put deltas in a checksum-prefixed subdirectory
Just to avoid overload.
src/libostree/ostree-core.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c
index 5de751f..8cfc6d9 100644
--- a/src/libostree/ostree-core.c
+++ b/src/libostree/ostree-core.c
@@ -1321,18 +1321,31 @@ _ostree_get_relative_object_path (const char *checksum,
return g_string_free (path, FALSE);
}
+static char *
+get_delta_path (const char *from,
+ const char *to,
+ const char *target)
+{
+ char prefix[3];
+ prefix[0] = from[0];
+ prefix[1] = from[1];
+ prefix[2] = '\0';
+ from += 2;
+ return g_strconcat ("deltas/", prefix, "/", from, "-", to, "/", target, NULL);
+}
+
char *
_ostree_get_relative_static_delta_path (const char *from,
const char *to)
{
- return g_strdup_printf ("deltas/%s-%s/superblock", from, to);
+ return get_delta_path (from, to, "superblock");
}
char *
_ostree_get_relative_static_delta_detachedmeta_path (const char *from,
const char *to)
{
- return g_strdup_printf ("deltas/%s-%s/meta", from, to);
+ return get_delta_path (from, to, "meta");
}
char *
@@ -1340,7 +1353,8 @@ _ostree_get_relative_static_delta_part_path (const char *from,
const char *to,
guint i)
{
- return g_strdup_printf ("deltas/%s-%s/%u", from, to, i);
+ gs_free char *partstr = g_strdup_printf ("%u", i);
+ return get_delta_path (from, to, partstr);
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]