After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 706031 - Miscellaneous API changes in preparation for static deltas
Miscellaneous API changes in preparation for static deltas
Status: RESOLVED FIXED
Product: ostree
Classification: Infrastructure
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: OSTree maintainer(s)
OSTree maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-08-14 22:51 UTC by Colin Walters
Modified: 2013-08-15 02:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
core: Add API to convert checksum -> csum in place (1.62 KB, patch)
2013-08-14 22:51 UTC, Colin Walters
reviewed Details | Review
repo: Add API to load any object as a stream (4.85 KB, patch)
2013-08-14 22:51 UTC, Colin Walters
reviewed Details | Review
libotutil: Add API to create an "ay" GVariant from GBytes (2.86 KB, patch)
2013-08-14 22:51 UTC, Colin Walters
committed Details | Review
fileutils: Add API to fstat() a stream (3.02 KB, patch)
2013-08-15 00:45 UTC, Colin Walters
committed Details | Review
core: Add API to convert checksum -> csum in place (2.38 KB, patch)
2013-08-15 00:45 UTC, Colin Walters
committed Details | Review
libotutil: Make use of GBytes in ot_variant_read() (1.38 KB, patch)
2013-08-15 00:45 UTC, Colin Walters
committed Details | Review
repo: Add API to load any object as a stream (4.85 KB, patch)
2013-08-15 00:47 UTC, Colin Walters
accepted-commit_now Details | Review
repo: Add API to load any object as a stream (9.95 KB, patch)
2013-08-15 01:52 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2013-08-14 22:51:09 UTC
Broken out of that patch series.
Comment 1 Colin Walters 2013-08-14 22:51:13 UTC
Created attachment 251664 [details] [review]
core: Add API to convert checksum -> csum in place

We already have the opposite, and this will be used in some
places to avoid a malloc.
Comment 2 Colin Walters 2013-08-14 22:51:20 UTC
Created attachment 251665 [details] [review]
repo: Add API to load any object as a stream

We have APIs to load metadata as variants, and files as parsed
content/info/xattrs, but for some cases such as static deltas, all we
want is to operate on all objects in their canonical representation.
Comment 3 Colin Walters 2013-08-14 22:51:25 UTC
Created attachment 251666 [details] [review]
libotutil: Add API to create an "ay" GVariant from GBytes

We used to have a version of this, but since I'm trying to use
GBytes more, this became a more common operation, and it's annoying
to type out the whole G_VARIANT_TYPE ("ay") each time, and pass
TRUE for trusted.
Comment 4 Jasper St. Pierre (not reading bugmail) 2013-08-14 22:56:45 UTC
Review of attachment 251666 [details] [review]:

OK.
Comment 5 Jasper St. Pierre (not reading bugmail) 2013-08-14 22:56:59 UTC
Review of attachment 251664 [details] [review]:

::: src/libostree/ostree-core.c
@@ +1017,3 @@
+                                  guchar     *buf)
+{
+  checksum_to_bytes (checksum, buf);

Do you not just want to replace checksum_to_bytes and make ostree_checksum_to_bytes call the public function?
Comment 6 Jasper St. Pierre (not reading bugmail) 2013-08-14 23:15:57 UTC
Review of attachment 251665 [details] [review]:

::: src/libostree/ostree-repo.c
@@ +2183,3 @@
+
+      if (!ostree_repo_load_variant (self, objtype, checksum, &metadata, error))
+        goto out;

Hm, given that the common case is that this generates a GVariant from a GMappedFile, it's a bit silly to read out the mmap contents and then stick it all in a GMemoryInputStream. Could you add something in ostree_repo_load_variant that somehow checks if the variant comes from a GMappedFile and then just create the GMappedFileInputStream from it?

Perhaps with some sneaky underhanded gdatalist shenanigans?
Comment 7 Colin Walters 2013-08-15 00:45:08 UTC
Created attachment 251669 [details] [review]
fileutils: Add API to fstat() a stream

Will be used by ostree.  Since libgsystem will return raw
GUnix{Input,Output}Stream, we need a way to fstat() them.  Maybe we
should also have an API to synthesize a #GFileInfo, but that's hard
without duplicating all the complex stuff in GIO.
Comment 8 Colin Walters 2013-08-15 00:45:39 UTC
Created attachment 251670 [details] [review]
core: Add API to convert checksum -> csum in place

We already have the opposite, and this will be used in some
places to avoid a malloc.
Comment 9 Colin Walters 2013-08-15 00:45:51 UTC
Created attachment 251671 [details] [review]
libotutil: Make use of GBytes in ot_variant_read()

This is just cleaner; we avoid using GObject data, etc.
Comment 10 Colin Walters 2013-08-15 00:47:19 UTC
Created attachment 251672 [details] [review]
repo: Add API to load any object as a stream

Although before we never actually *copied* data, it was mildly lame to
have a chain of mmap -> GMemoryInputStream, when we can just as easily
do a normal open() -> read() chain.
Comment 11 Jasper St. Pierre (not reading bugmail) 2013-08-15 00:51:39 UTC
Review of attachment 251670 [details] [review]:

OK.
Comment 12 Jasper St. Pierre (not reading bugmail) 2013-08-15 00:52:32 UTC
Review of attachment 251671 [details] [review]:

OK.
Comment 13 Jasper St. Pierre (not reading bugmail) 2013-08-15 00:56:32 UTC
Did you forget to attach the patch that modifies ostree_variant_read?
Comment 14 Jasper St. Pierre (not reading bugmail) 2013-08-15 00:59:59 UTC
Did you forget to attach the patch that modifies ostree_variant_read?
Comment 15 Colin Walters 2013-08-15 01:12:29 UTC
(In reply to comment #14)
> Did you forget to attach the patch that modifies ostree_variant_read?

There's one in comment #9 but note we weren't actually copying data before either.  g_memory_input_stream_new_from_data() doesn't copy.
Comment 16 Colin Walters 2013-08-15 01:23:04 UTC
(In reply to comment #14)
> Did you forget to attach the patch that modifies ostree_variant_read?

There's one in comment #9 but note we weren't actually copying data before either.  g_memory_input_stream_new_from_data() doesn't copy.
Comment 17 Jasper St. Pierre (not reading bugmail) 2013-08-15 01:32:08 UTC
(In reply to comment #16)
> (In reply to comment #14)
> > Did you forget to attach the patch that modifies ostree_variant_read?
> 
> There's one in comment #9 but note we weren't actually copying data before
> either.  g_memory_input_stream_new_from_data() doesn't copy.

Ah, right, I forgot that GMappedFile isn't actually a GFile that we can g_file_read.
Comment 18 Jasper St. Pierre (not reading bugmail) 2013-08-15 01:32:32 UTC
Review of attachment 251669 [details] [review]:

OK.
Comment 19 Jasper St. Pierre (not reading bugmail) 2013-08-15 01:33:55 UTC
Review of attachment 251672 [details] [review]:

OK.
Comment 20 Colin Walters 2013-08-15 01:51:16 UTC
Attachment 251670 [details] pushed as d9f59c6 - core: Add API to convert checksum -> csum in place
Attachment 251671 [details] pushed as c77908b - libotutil: Make use of GBytes in ot_variant_read()
Comment 21 Colin Walters 2013-08-15 01:52:18 UTC
Created attachment 251677 [details] [review]
repo: Add API to load any object as a stream

Oops, I forgot to amend the last commit, that may have been what was
confusing you...this has the cleaner code.
Comment 22 Jasper St. Pierre (not reading bugmail) 2013-08-15 01:53:54 UTC
Review of attachment 251677 [details] [review]:

This is indeed a lot better; thanks.
Comment 23 Colin Walters 2013-08-15 02:11:19 UTC
Attachment 251677 [details] pushed as 11bdbe1 - repo: Add API to load any object as a stream