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

Update docs to conform to Tokio standards #203

Merged
merged 18 commits into from
Jan 26, 2023
Merged

Conversation

rrichardson
Copy link
Contributor

@rrichardson rrichardson commented Dec 29, 2022

This PR does 3 2 things:
1. Alters the Runtime crate::Builder API slightly to make it easier to correctly set sq and cq entry counts.
2. Updates method documentation to use indicative mood. This is not a huge change, as most public method docs were conformant.
3. Enhances other documentation in a few places for clarity.

Copy link
Contributor

@Noah-Kennedy Noah-Kennedy left a comment

Choose a reason for hiding this comment

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

I left some feedback, but overall this is a great improvement!

src/fs/directory.rs Outdated Show resolved Hide resolved
src/fs/directory.rs Outdated Show resolved Hide resolved
src/runtime/mod.rs Show resolved Hide resolved
src/fs/directory.rs Show resolved Hide resolved
src/fs/directory.rs Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
src/net/udp.rs Show resolved Hide resolved
src/runtime/mod.rs Outdated Show resolved Hide resolved
src/runtime/mod.rs Outdated Show resolved Hide resolved
@Noah-Kennedy
Copy link
Contributor

I'd strongly recommend using cargo doc to look at how any changes in the docs would render.

Copy link
Collaborator

@FrankReh FrankReh left a comment

Choose a reason for hiding this comment

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

Generally I'm not for PRs that mix comments with changes to an API. Why not propose the comment improvements as a separate PR?

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
@Noah-Kennedy
Copy link
Contributor

@FrankReh that's a good point, maybe this should be narrowed to only doc changes, and API changes can go in another PR.

@rrichardson
Copy link
Contributor Author

Generally I'm not for PRs that mix comments with changes to an API. Why not propose the comment improvements as a separate PR?

I am with you on this. I started off working only on documentation, but I couldn't get past the weird/inconsistent settings for sq and cq entries.

I agree that the implementation is a bit weird, it is a side effect of (sometimes) transparently using the urb for the actual initialization. I'm not super happy with it either.

As you suggest, I will submit the doc changes as a PR.
Regarding the code changes: I think the Builder API(s) need(s) some refactoring to make them more ergonomic and foolproof, so it will probably require some design discussion. I'll create a ticket for discussion.

@Noah-Kennedy
Copy link
Contributor

It's probably best to leave this open as a PR for the doc changes, due to the feedback already present.

@rrichardson rrichardson reopened this Dec 30, 2022
@rrichardson
Copy link
Contributor Author

I'd strongly recommend using cargo doc to look at how any changes in the docs would render.

I typically follow this workflow, however, in this case, it is not terribly convenient. My work computer is a macbook, and my dev box is a corporate managed Linux VM with limited access. I'll see if I can come up with a convenient way to sync the docs from my dev box (I need to create a static webserver for documentation anyways)

@FrankReh
Copy link
Collaborator

This PR would be good to use for the comments. The title or description can be changed to just reference improving comments when it is squash-merged.

@rrichardson rrichardson changed the title Streamline the Builder API, update docs to use indicative mood Update docs to conform to Tokio standards Dec 30, 2022
Copy link
Collaborator

@FrankReh FrankReh left a comment

Choose a reason for hiding this comment

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

Lots of very good improvements to the comments, thank you.

Sorry, I know my comments about comments sound harsh today. Not having a quiet/let-the-chips-fall-where-they-may-day I guess.

Also, I know the interface for setting the io-uring builder isn't idiomatic. I wasn't aware of any problems with it though. And certainly before ever getting to 1.0, we would probably just copy all the io-uring builder methods and pass them through. I expected the io-uring builder API to still be changing frequently so didn't want to duplicate the efforts yet. Maybe the uring API isn't changing so much anymore these days either.

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
src/net/udp.rs Outdated Show resolved Hide resolved
src/runtime/mod.rs Outdated Show resolved Hide resolved
src/runtime/mod.rs Outdated Show resolved Hide resolved
@rrichardson
Copy link
Contributor Author

Ok. I've removed the API changes, and also found a few more spots where the docs needed updating.

Also, I've created #204 to discuss changes to the Builder API

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/net/udp.rs Show resolved Hide resolved
src/net/udp.rs Outdated Show resolved Hide resolved
src/net/udp.rs Outdated Show resolved Hide resolved
src/runtime/mod.rs Outdated Show resolved Hide resolved
src/fs/directory.rs Outdated Show resolved Hide resolved
src/fs/directory.rs Show resolved Hide resolved
src/fs/directory.rs Outdated Show resolved Hide resolved
src/fs/directory.rs Show resolved Hide resolved
src/runtime/mod.rs Outdated Show resolved Hide resolved
src/fs/file.rs Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
@rrichardson
Copy link
Contributor Author

Hopefully that's everything?

src/net/tcp/stream.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@FrankReh FrankReh left a comment

Choose a reason for hiding this comment

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

And Noah's review is needed so maybe wait on any further changes to see what his take is. Thank you.

src/net/tcp/stream.rs Outdated Show resolved Hide resolved
src/net/tcp/stream.rs Outdated Show resolved Hide resolved
src/net/tcp/stream.rs Show resolved Hide resolved
src/net/tcp/stream.rs Outdated Show resolved Hide resolved
src/net/udp.rs Outdated Show resolved Hide resolved
src/net/udp.rs Outdated Show resolved Hide resolved
src/runtime/mod.rs Outdated Show resolved Hide resolved
/// complete, and yielding its resolved result. Any tasks, futures, or timers
/// which the future spawns internally will be executed on this runtime.
///
/// Any spawned tasks will be suspended after `block_on` returns. Calling
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Noah-Kennedy needs to judge whether this statement about block_on is correct and whether it is correct to imply that block_on could be called more than once. Maybe it can and this is absolutely correct; I'm just saying I'm not sure myself

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be good to get a comment, but I based those docs on the tokio docs for block_on
https://docs.rs/tokio/latest/tokio/runtime/struct.Runtime.html#current-thread-scheduler

Copy link
Collaborator

Choose a reason for hiding this comment

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

Again, if we don't hear from @Noah-Kennedy, you can just remove this change for now because while I like comments, I really care about technical comments that help us understand the tricky stuff when wanting to modify the design. The over all stuff about how to use it and how it relates to tokio I would prefer to leave to Noah over time.

@rrichardson
Copy link
Contributor Author

rrichardson commented Jan 19, 2023

On a side note: I am really hoping that pushing a new version of the docs will fix the existing online docs, because they're broke AF

Copy link
Collaborator

@FrankReh FrankReh left a comment

Choose a reason for hiding this comment

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

Looks good. If you want to leave it and wait for Noah, you are welcome to. If you want to back out the help for starting, I can merge the other stuff.

src/net/tcp/stream.rs Show resolved Hide resolved
src/runtime/mod.rs Show resolved Hide resolved
/// complete, and yielding its resolved result. Any tasks, futures, or timers
/// which the future spawns internally will be executed on this runtime.
///
/// Any spawned tasks will be suspended after `block_on` returns. Calling
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again, if we don't hear from @Noah-Kennedy, you can just remove this change for now because while I like comments, I really care about technical comments that help us understand the tricky stuff when wanting to modify the design. The over all stuff about how to use it and how it relates to tokio I would prefer to leave to Noah over time.

Copy link
Collaborator

@FrankReh FrankReh left a comment

Choose a reason for hiding this comment

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

Thanks. Will wait 'till the end of the day in case @Noah-Kennedy wants to comment further, otherwise I'll merge what's there.

@FrankReh
Copy link
Collaborator

@rrichardson Would it be easy for you to merge from mainline to pick up the change to udp.rs from earlier today and push again?

@Noah-Kennedy
Copy link
Contributor

@rrichardson I will merge this as soon as you update this branch from master and resolve conflicts.

@rrichardson
Copy link
Contributor Author

@rrichardson I will merge this as soon as you update this branch from master and resolve conflicts.

Done.

@FrankReh
Copy link
Collaborator

Unfortunately the latest comment addition doesn't get past a CI documentation check.

@FrankReh FrankReh merged commit bf352a6 into tokio-rs:master Jan 26, 2023
@FrankReh
Copy link
Collaborator

Thanks!

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