Skip to content
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

Closed
wants to merge 13 commits into from
Closed

Conversation

cgwalters
Copy link
Member

No description provided.

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.
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.
@cgwalters
Copy link
Member Author

OK, this one should be good to review and land I think.

cgwalters added a commit to cgwalters/cockpit that referenced this pull request Jan 4, 2017
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)
@jlebon jlebon self-requested a review January 4, 2017 15:37
Copy link
Member

@jlebon jlebon left a 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,
Copy link
Member

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out_bytes ?

@cgwalters
Copy link
Member Author

☑️

@jlebon
Copy link
Member

jlebon commented Jan 4, 2017

@rh-atomic-bot r+ 78609ca

@rh-atomic-bot
Copy link

⌛ Testing commit 78609ca with merge 062cc7e...

rh-atomic-bot pushed a commit that referenced this pull request Jan 4, 2017
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
rh-atomic-bot pushed a commit that referenced this pull request Jan 4, 2017
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
rh-atomic-bot pushed a commit that referenced this pull request Jan 4, 2017
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
rh-atomic-bot pushed a commit that referenced this pull request Jan 4, 2017
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
rh-atomic-bot pushed a commit that referenced this pull request Jan 4, 2017
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
rh-atomic-bot pushed a commit that referenced this pull request Jan 4, 2017
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
@rh-atomic-bot
Copy link

💔 Test failed - status-atomicjenkins

@jlebon
Copy link
Member

jlebon commented Jan 4, 2017

@rh-atomic-bot r+ ffcc250

@rh-atomic-bot
Copy link

⌛ Testing commit ffcc250 with merge d9f43cd...

rh-atomic-bot pushed a commit that referenced this pull request Jan 4, 2017
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
rh-atomic-bot pushed a commit that referenced this pull request Jan 4, 2017
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
rh-atomic-bot pushed a commit that referenced this pull request Jan 4, 2017
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
rh-atomic-bot pushed a commit that referenced this pull request Jan 4, 2017
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
rh-atomic-bot pushed a commit that referenced this pull request Jan 4, 2017
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
@rh-atomic-bot
Copy link

☀️ Test successful - status-atomicjenkins
Approved by: jlebon
Pushing d9f43cd to master...

@rh-atomic-bot rh-atomic-bot changed the title Fetcher cleanup [merged] Fetcher cleanup Jan 4, 2017
petervo added a commit to petervo/cockpit that referenced this pull request Jan 5, 2017
trivial-httpd will be depreciated.

Related: ostreedev/ostree#636
stefwalter pushed a commit to cockpit-project/cockpit that referenced this pull request Jan 5, 2017
trivial-httpd will be depreciated.

Related: ostreedev/ostree#636

Closes #5680
Closes #5682
Reviewed-by: Stef Walter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants