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

Move the Reactor to its own module #413

Merged
merged 1 commit into from
Sep 22, 2021

Conversation

duarten
Copy link
Member

@duarten duarten commented Sep 21, 2021

What does this PR do?

This will make it easier to introduce multiple Reactors, such as a no-op
one (to use glommio for its task scheduling, TPC capabilities) or one
suited for a different platform, like macOS.

Motivation

The larger goal is to make it smooth to develop for glommio in macOS.

Related issues

Additional Notes

Checklist

[] I have added unit tests to the code I am submitting
[] My unit tests cover both failure and success scenarios
[] If applicable, I have discussed my architecture

This will make it easier to introduce multiple Reactors, such as a no-op
one (to use glommio for its task scheduling, TPC capabilities) or one
suited for a different platform, like macOS.
@duarten duarten changed the title Move the React to its own module Move the Reactor to its own module Sep 21, 2021
Copy link
Collaborator

@glommer glommer left a comment

Choose a reason for hiding this comment

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

I am fine with this direction, but I was hoping more code would be shared in parking.rs than currently. It seems like you will eventually have to implement all of the operation functions (like read and write), to all reactors, but ultimately all they are doing is creating a Source and passing it down to the per-system reactor.

Why did you feel like this level of abstraction is the best ?

@duarten
Copy link
Member Author

duarten commented Sep 21, 2021

I am fine with this direction, but I was hoping more code would be shared in parking.rs than currently.

I'm not sure we disagree on the direction, I think I didn't properly explain my thinking. I didn't mean to say that there won't be any code sharing. parking.rs has two aspects to it, actual parking and the reactor. If we add more code to the reactor aspect, then I think it makes sense to move it to a separate file.

A way to share code is to make Reactor generic on Flavor, have an implementation for all flavors (impl<T: Flavour> for Reactor<T>) and specific impls for each specific flavor, as needed.

It seems like you will eventually have to implement all of the operation functions (like read and write), to all reactors, but ultimately all they are doing is creating a Source and passing it down to the per-system reactor.

Why did you feel like this level of abstraction is the best ?

Per-system code will still live in sys, but for some reactors we may want to pick and choose which operations they expose. For a particular flavor, we may not expose any tcp functions. Having that behind an impl allows me to apply a conditional compilation attribute to the whole impl, instead of to individual functions.

Relying on conditional compilation attributes avoids runtime panics, but maybe that's too much work; in that case it makes total sense to change the type of Reactor::sys and panic!() some functions.

@glommer
Copy link
Collaborator

glommer commented Sep 21, 2021

makes sense.

@glommer
Copy link
Collaborator

glommer commented Sep 21, 2021

FWIW: CI is not running for you. @HippoBaro recently found out that this is because you don't have a circleCI account. Likely if we don't find a way around this, ideally we'd move away from circleCI.

@duarten
Copy link
Member Author

duarten commented Sep 22, 2021

I'll create an account! I can volunteer some time to move to github actions if you want to get rid of this hurdle.

@HippoBaro
Copy link
Member

I'll create an account! I can volunteer some time to move to github actions if you want to get rid of this hurdle.

If you can spare the time, that would be great! I did the initial Circle CI setup but I have to admit that I'm not very knowledgeable when it comes to that stuff.

Are you suggesting that we could use GH actions to trigger CI for PRs created by external contributors?

To be honest I'm still in disbelief that Circle CI can't manage to do that by default.

@duarten
Copy link
Member Author

duarten commented Sep 22, 2021

I'll create an account! I can volunteer some time to move to github actions if you want to get rid of this hurdle.

If you can spare the time, that would be great! I did the initial Circle CI setup but I have to admit that I'm not very knowledgeable when it comes to that stuff.

Are you suggesting that we could use GH actions to trigger CI for PRs created by external contributors?

To be honest I'm still in disbelief that Circle CI can't manage to do that by default.

Github actions would be the CI. Basically move .circleci/config.yml to .github/workflows/{meaningful name}.yml and translate the yaml. Github actions even includes rusts and cargo, with clippy and rustfmt installed.

@HippoBaro
Copy link
Member

I'll create an account! I can volunteer some time to move to github actions if you want to get rid of this hurdle.

If you can spare the time, that would be great! I did the initial Circle CI setup but I have to admit that I'm not very knowledgeable when it comes to that stuff.

Are you suggesting that we could use GH actions to trigger CI for PRs created by external contributors?

To be honest I'm still in disbelief that Circle CI can't manage to do that by default.

Github actions would be the CI. Basically move .circleci/config.yml to .github/workflows/{meaningful name}.yml and translate the yaml. Github actions even includes rusts and cargo, with clippy and rustfmt installed.

Ok that makes sense. However we may want to hold off on that one. The reason being that we currently are unable to run the unit tests in our current CI because the kernel isn't new enough.

If GH actions have a good kernel then great, but otherwise it may be worth investigating a longer term solution. Wdyt?

@duarten
Copy link
Member Author

duarten commented Sep 22, 2021

If GH actions have a good kernel then great, but otherwise it may be worth investigating a longer term solution. Wdyt?

The kernel version is 5.8.0-1041-azure. I think that's enough?

But if we outpace the kernel of the GH hosted runners, we have the option of providing self-hosted runners.

@glommer
Copy link
Collaborator

glommer commented Sep 22, 2021

5.8 is good enough

Copy link
Member

@HippoBaro HippoBaro left a comment

Choose a reason for hiding this comment

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

LGTM!

@glommer glommer merged commit 4cedc9c into DataDog:master Sep 22, 2021
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