core: Re-unify on one OSTREE_OBJECT_TYPE_FILE

Having the archived vs not distinction in the object system wasn't
useful in light of pack files.  In fact, we should probably move
towards generating a pack file per commit by default.
This commit is contained in:
Colin Walters committed 2012-04-11 22:27:59 -04:00
1 parent f15c184584
commit 38ef75e6e0
22 files changed
+1062 -805

No files matched your search

+33 -6
View File
@@ -228,6 +228,36 @@ ot_gfile_get_basename_cached (GFile *file)
return name;
}
gboolean
ot_gio_write_update_checksum (GOutputStream *out,
gconstpointer data,
gsize len,
gsize *out_bytes_written,
GChecksum *checksum,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
if (out)
{
if (!g_output_stream_write_all (out, data, len, out_bytes_written,
cancellable, error))
goto out;
}
else if (out_bytes_written)
{
*out_bytes_written = len;
}
if (checksum)
g_checksum_update (checksum, data, len);
ret = TRUE;
out:
return ret;
}
gboolean
ot_gio_splice_update_checksum (GOutputStream *out,
GInputStream *in,
@@ -247,12 +277,9 @@ ot_gio_splice_update_checksum (GOutputStream *out,
{
if (!g_input_stream_read_all (in, buf, sizeof(buf), &bytes_read, cancellable, error))
goto out;
g_checksum_update (checksum, (guint8*)buf, bytes_read);
if (out)
{
if (!g_output_stream_write_all (out, buf, bytes_read, &bytes_written, cancellable, error))
goto out;
}
if (!ot_gio_write_update_checksum (out, buf, bytes_read, &bytes_written, checksum,
cancellable, error))
goto out;
}
while (bytes_read > 0);
}
+8
View File
@@ -61,6 +61,14 @@ gboolean ot_gfile_load_contents_utf8 (GFile *file,
GCancellable *cancellable,
GError **error);
gboolean ot_gio_write_update_checksum (GOutputStream *out,
gconstpointer data,
gsize len,
gsize *out_bytes_written,
GChecksum *checksum,
GCancellable *cancellable,
GError **error);
gboolean ot_gio_splice_get_checksum (GOutputStream *out,
GInputStream *in,
guchar **out_csum,
+14
View File
@@ -175,3 +175,17 @@ ot_util_variant_from_stream (GInputStream *src,
out:
return ret;
}
GInputStream *
ot_variant_read (GVariant *variant)
{
GMemoryInputStream *ret = NULL;
ret = (GMemoryInputStream*)g_memory_input_stream_new_from_data (g_variant_get_data (variant),
g_variant_get_size (variant),
NULL);
g_object_set_data_full ((GObject*)ret, "ot-variant-data",
g_variant_ref (variant), (GDestroyNotify) g_variant_unref);
return (GInputStream*)ret;
}
+2
View File
@@ -69,6 +69,8 @@ gboolean ot_util_variant_from_stream (GInputStream *src,
GCancellable *cancellable,
GError **error);
GInputStream *ot_variant_read (GVariant *variant);
G_END_DECLS
#endif