deltas: Add _ostree_get_relative_static_delta_index_path()

This gets the subpath for a delta index file, which is of the form
"delta-indexes/$commit.index", that contains all the deltas going
to the particular commit.
This commit is contained in:
Alexander Larsson 2020-09-01 12:00:32 +02:00
parent f8f6464580
commit 87e564eeaa
2 changed files with 28 additions and 5 deletions

View File

@ -135,6 +135,9 @@ _ostree_get_relative_static_delta_part_path (const char *from,
const char *to,
guint i);
char *
_ostree_get_relative_static_delta_index_path (const char *to);
static inline char * _ostree_get_commitpartial_path (const char *checksum)
{
return g_strconcat ("state/", checksum, ".commitpartial", NULL);

View File

@ -1814,15 +1814,15 @@ _ostree_get_relative_object_path (const char *checksum,
return g_string_free (path, FALSE);
}
char *
_ostree_get_relative_static_delta_path (const char *from,
const char *to,
const char *target)
static GString *
static_delta_path_base (const char *dir,
const char *from,
const char *to)
{
guint8 csum_to[OSTREE_SHA256_DIGEST_LEN];
char to_b64[44];
guint8 csum_to_copy[OSTREE_SHA256_DIGEST_LEN];
GString *ret = g_string_new ("deltas/");
GString *ret = g_string_new (dir);
ostree_checksum_inplace_to_bytes (to, csum_to);
ostree_checksum_b64_inplace_from_bytes (csum_to, to_b64);
@ -1851,6 +1851,16 @@ _ostree_get_relative_static_delta_path (const char *from,
g_string_append_c (ret, '/');
g_string_append (ret, to_b64 + 2);
return ret;
}
char *
_ostree_get_relative_static_delta_path (const char *from,
const char *to,
const char *target)
{
GString *ret = static_delta_path_base ("deltas/", from, to);
if (target != NULL)
{
g_string_append_c (ret, '/');
@ -1883,6 +1893,16 @@ _ostree_get_relative_static_delta_part_path (const char *from,
return _ostree_get_relative_static_delta_path (from, to, partstr);
}
char *
_ostree_get_relative_static_delta_index_path (const char *to)
{
GString *ret = static_delta_path_base ("delta-indexes/", NULL, to);
g_string_append (ret, ".index");
return g_string_free (ret, FALSE);
}
gboolean
_ostree_parse_delta_name (const char *delta_name,
char **out_from,