-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[merged] Fetcher cleanup #636
Conversation
This is in preparation for the libcurl port. We're basically making public what we had internally. The next step here is to create `ostree-fetcher-util.[ch]` that only operates in terms of this lower level API. Also drop the `_mirrored` from the function name since it's the default now.
Conceptually these now lay on top of the core API, and don't reference libsoup. This is preparation for libcurl porting, but it's also just generally better.
The previous commit introduced a single low level API - however, we can do things in a more optimal way for the curl backend if we drop the "streaming API" variant. Currently, we only use it to synchronously splice into a memory buffer...which is pretty silly when we could just do that in the backend. The only tweak here is that we have an "add NUL character" flag that is (possibly) needed when fetching into a membuf. The code here ends up being better I think, since we avoid the double return value for the `_finish()` invocation, and now most of the fetcher code (in the soup case) writes to a `GOutputStream` consistently. This will again make things easier for a curl backend.
ecd2b12
to
8dc0db3
Compare
I'm introducing a new binary in a later patch, and it makes sense to move more things to be common into the common section. Also I noticed we were missing an inclusion of common `$(AM_LDFLAGS)`, though AFAIK this doesn't break anything right now.
Working on the libcurl backend, I hit the issue that the trivial-httpd program depends on libsoup. I briefly considered having two versions, but libcurl is client only, and moreover trivial-httpd is no longer trivial - it has various features which are used by the test suite extensively. Hence, what we'll do is build it as a separate binary which links to libsoup, and use it during the tests. We *also* currently still provide `ostree trivial-httpd` since some things use it like `rpm-ostree-toolbox` and the Cockpit tests. After those are ported to use some other webserver, I plan to add a build-time option to drop it.
For the pending libcurl port, the backend is a bit more sensitive to the main context setup. The delta superblock fetch here is a synchronous request in the section that's supposed to be async. Now, libsoup definitely supports mixing sync and async requests, but it wasn't hard to help the libcurl port here by making this one async. Now fetchers are either sync or async.
OK, this one should be good to review and land I think. |
I'm trying to add a libcurl backend to ostree, and I'd like people to stop using trivial-httpd; it was a mistake to have it be command line API. Related: ostreedev/ostree#636 (Note I didn't test this commit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff, I like the fetcher simplifications. Just a small nit.
gboolean | ||
_ostree_fetcher_request_to_membuf_finish (OstreeFetcher *self, | ||
GAsyncResult *result, | ||
GBytes **out_filename, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out_bytes
?
|
||
gboolean _ostree_fetcher_request_to_membuf_finish (OstreeFetcher *self, | ||
GAsyncResult *result, | ||
GBytes **out_filename, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out_bytes
?
☑️ |
This is in preparation for the libcurl port. We're basically making public what we had internally. The next step here is to create `ostree-fetcher-util.[ch]` that only operates in terms of this lower level API. Also drop the `_mirrored` from the function name since it's the default now. Closes: #636 Approved by: jlebon
Conceptually these now lay on top of the core API, and don't reference libsoup. This is preparation for libcurl porting, but it's also just generally better. Closes: #636 Approved by: jlebon
The previous commit introduced a single low level API - however, we can do things in a more optimal way for the curl backend if we drop the "streaming API" variant. Currently, we only use it to synchronously splice into a memory buffer...which is pretty silly when we could just do that in the backend. The only tweak here is that we have an "add NUL character" flag that is (possibly) needed when fetching into a membuf. The code here ends up being better I think, since we avoid the double return value for the `_finish()` invocation, and now most of the fetcher code (in the soup case) writes to a `GOutputStream` consistently. This will again make things easier for a curl backend. Closes: #636 Approved by: jlebon
I'm introducing a new binary in a later patch, and it makes sense to move more things to be common into the common section. Also I noticed we were missing an inclusion of common `$(AM_LDFLAGS)`, though AFAIK this doesn't break anything right now. Closes: #636 Approved by: jlebon
Working on the libcurl backend, I hit the issue that the trivial-httpd program depends on libsoup. I briefly considered having two versions, but libcurl is client only, and moreover trivial-httpd is no longer trivial - it has various features which are used by the test suite extensively. Hence, what we'll do is build it as a separate binary which links to libsoup, and use it during the tests. We *also* currently still provide `ostree trivial-httpd` since some things use it like `rpm-ostree-toolbox` and the Cockpit tests. After those are ported to use some other webserver, I plan to add a build-time option to drop it. Closes: #636 Approved by: jlebon
For the pending libcurl port, the backend is a bit more sensitive to the main context setup. The delta superblock fetch here is a synchronous request in the section that's supposed to be async. Now, libsoup definitely supports mixing sync and async requests, but it wasn't hard to help the libcurl port here by making this one async. Now fetchers are either sync or async. Closes: #636 Approved by: jlebon
💔 Test failed - status-atomicjenkins |
Conceptually these now lay on top of the core API, and don't reference libsoup. This is preparation for libcurl porting, but it's also just generally better. Closes: #636 Approved by: jlebon
The previous commit introduced a single low level API - however, we can do things in a more optimal way for the curl backend if we drop the "streaming API" variant. Currently, we only use it to synchronously splice into a memory buffer...which is pretty silly when we could just do that in the backend. The only tweak here is that we have an "add NUL character" flag that is (possibly) needed when fetching into a membuf. The code here ends up being better I think, since we avoid the double return value for the `_finish()` invocation, and now most of the fetcher code (in the soup case) writes to a `GOutputStream` consistently. This will again make things easier for a curl backend. Closes: #636 Approved by: jlebon
I'm introducing a new binary in a later patch, and it makes sense to move more things to be common into the common section. Also I noticed we were missing an inclusion of common `$(AM_LDFLAGS)`, though AFAIK this doesn't break anything right now. Closes: #636 Approved by: jlebon
Working on the libcurl backend, I hit the issue that the trivial-httpd program depends on libsoup. I briefly considered having two versions, but libcurl is client only, and moreover trivial-httpd is no longer trivial - it has various features which are used by the test suite extensively. Hence, what we'll do is build it as a separate binary which links to libsoup, and use it during the tests. We *also* currently still provide `ostree trivial-httpd` since some things use it like `rpm-ostree-toolbox` and the Cockpit tests. After those are ported to use some other webserver, I plan to add a build-time option to drop it. Closes: #636 Approved by: jlebon
For the pending libcurl port, the backend is a bit more sensitive to the main context setup. The delta superblock fetch here is a synchronous request in the section that's supposed to be async. Now, libsoup definitely supports mixing sync and async requests, but it wasn't hard to help the libcurl port here by making this one async. Now fetchers are either sync or async. Closes: #636 Approved by: jlebon
☀️ Test successful - status-atomicjenkins |
trivial-httpd will be depreciated. Related: ostreedev/ostree#636
trivial-httpd will be depreciated. Related: ostreedev/ostree#636 Closes #5680 Closes #5682 Reviewed-by: Stef Walter <[email protected]>
No description provided.