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

libimage: add an events system #524

Merged
merged 1 commit into from
May 6, 2021

Conversation

vrothberg
Copy link
Member

Add an event system to libimage. Callers can opt-in to using events by
requesting an event channel via (*Runtime).EventChannel(). The
returned channel has a buffer of size 100 which should be sufficient
even under high loads. But, to be on the safe side, writing an event
will time out after 2 seconds to prevent operations from blocking.

Currently, the only user of such an event system is Podman which will
need to convert the Event type to what's used internally in libpod.

Signed-off-by: Valentin Rothberg [email protected]

@vrothberg
Copy link
Member Author

Podman counter-part -> containers/podman#10219

@rhatdan
Copy link
Member

rhatdan commented May 5, 2021

LGTM

@rhatdan
Copy link
Member

rhatdan commented May 5, 2021

@containers/podman-maintainers PTAL

@vrothberg
Copy link
Member Author

Let's wait until containers/podman#10219 turns green.

@mheon
Copy link
Member

mheon commented May 5, 2021

It feels like it might be better to move the Libpod events code into common and use it directly - I'm concerned by the potentially-competing definitions of Event, for example.

@vrothberg
Copy link
Member Author

It feels like it might be better to move the Libpod events code into common and use it directly - I'm concerned by the potentially-competing definitions of Event, for example.

IMHO that's out of scope of libimage. I try hard to keep libimage self-contained and really don't want to move more code around.

@vrothberg
Copy link
Member Author

containers/podman#10219 passed the local system tests (remote events is broken), so we could merge.

@mheon
Copy link
Member

mheon commented May 5, 2021

I wouldn't put the events code in libimage, but elsewhere in c/common. It feels like a good place since it's no longer Podman specific.

@vrothberg
Copy link
Member Author

vrothberg commented May 5, 2021 via email

@rhatdan
Copy link
Member

rhatdan commented May 6, 2021

@giuseppe @saschagrunert PTAL and get this merged.

if r.eventChannel != nil {
return r.eventChannel
}
r.eventChannel = make(chan *Event, 100)
Copy link
Member

Choose a reason for hiding this comment

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

is the chan ever closed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, now it is in Shutdown().

Add an event system to libimage.  Callers can opt-in to using events by
requesting an event channel via `(*Runtime).EventChannel()`.  The
returned channel has a buffer of size 100 which should be sufficient
even under high loads.  But, to be on the safe side, writing an event
will time out after 2 seconds to prevent operations from blocking.

Currently, the only user of such an event system is Podman which will
need to convert the `Event` type to what's used internally in libpod.

Signed-off-by: Valentin Rothberg <[email protected]>
Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, vrothberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mheon
Copy link
Member

mheon commented May 6, 2021

I'm OK with merging as long as we make a card to complete the move of events into common at a later date.

@rhatdan
Copy link
Member

rhatdan commented May 6, 2021

/lgtm

@openshift-merge-robot openshift-merge-robot merged commit 1012a05 into containers:master May 6, 2021
M1cha pushed a commit to M1cha/common that referenced this pull request Dec 20, 2022
Regression caused by 011f899. We only want to build actual man
pages of course and not general docs.
This commit fixes the wildcard target to only use the `.1.md` files
instead of all markdown files.
Also add the step to the validate target to make sure CI tests this
target.

Fixes containers#524

Signed-off-by: Paul Holzinger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants