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

[refactor] split sandbox shim #345

Merged
merged 1 commit into from
Oct 27, 2023
Merged

Conversation

jprendes
Copy link
Collaborator

@jprendes jprendes commented Oct 2, 2023

This PR splits the sandbox/shim.rs module into smaller more maintainable submodules.
In the process of doing so this PR also:

  • Restricts the visibility of many symbols within the shim module that were publicly visible but not used outside the module.
  • Simplifies the how paths (stdin, stdout, stderr, and bundle) are stored in InstanceConfig to avoid unnecessary convertions to String back and forth. This also affects (hopefully simplifies) the stdio module.
  • Tries to minimize the use of .unwrap() in the shim module outside of tests and mutex poisoning.
  • Refactors Local's event handling to avoid spining a thread just to forward messages.

@jprendes jprendes force-pushed the split-sandbox-shim branch 30 times, most recently from 4f5f18b to 1440c73 Compare October 4, 2023 20:46
@jprendes jprendes force-pushed the split-sandbox-shim branch 2 times, most recently from 7ed6f58 to 3fe149b Compare October 11, 2023 13:10
@Mossaka
Copy link
Member

Mossaka commented Oct 17, 2023

Is this ready to review?

@jprendes
Copy link
Collaborator Author

This is waiting on #342 as it builds up on top of it.

@jprendes jprendes force-pushed the split-sandbox-shim branch 2 times, most recently from 8097bb8 to 7d21b2e Compare October 23, 2023 14:02
@jprendes jprendes marked this pull request as ready for review October 23, 2023 14:02
@jprendes jprendes changed the title Split sandbox shim [chore] split sandbox shim Oct 23, 2023
@jprendes
Copy link
Collaborator Author

Is this ready to review?

This is now ready for review :-)
Thanks for your patience!

Copy link
Member

@Mossaka Mossaka left a comment

Choose a reason for hiding this comment

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

Thanks for the cleaning up! I really love the refactoring work here and the new addition of RemoteEventSender.

At the same time, I think this PR is bigger than a chore PR. I've asked some questions regarding the code difference between the old shim.rs and the refactored files. I want to make sure that as a spliting PR, no logic has changed in the shim file.

Could you please review this PR? @cpuguy83

@jprendes jprendes force-pushed the split-sandbox-shim branch 2 times, most recently from 3a2c703 to d27c35a Compare October 23, 2023 20:53
@jprendes jprendes changed the title [chore] split sandbox shim [refactor] split sandbox shim Oct 23, 2023
@jprendes
Copy link
Collaborator Author

At the same time, I think this PR is bigger than a chore PR.

Changed the title to [refactor] as that should better reflect the changes in the PR.

Mossaka
Mossaka previously approved these changes Oct 26, 2023
Copy link
Member

@Mossaka Mossaka left a comment

Choose a reason for hiding this comment

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

Need a rebase

Mossaka
Mossaka previously approved these changes Oct 26, 2023
Copy link
Member

@Mossaka Mossaka left a comment

Choose a reason for hiding this comment

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

LGTM, I am hoping to get a second pair of eyes for reviewing. @jsturtevant @cpuguy83

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

LGTM, just one comment about the mod declaration. Not sure if its an issue.

@@ -14,7 +14,7 @@ pub mod sync;
pub use error::{Error, Result};
pub use instance::{Instance, InstanceConfig};
pub use manager::{Sandbox as SandboxService, Service as ManagerService};
pub use shim::{Cli as ShimCli, Local};
pub use shim::Cli as ShimCli;
Copy link
Member

Choose a reason for hiding this comment

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

My editor is complaing about pub mod shim at line 10 now that shim.rs is gone.
I'm a bit fuzzy on module semantics, though.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, this was just an editor thing. It disappered on its own.

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

LGTM, just one comment about the mod declaration. Not sure if its an issue.

@cpuguy83 cpuguy83 merged commit 59cab2f into containerd:main Oct 27, 2023
43 checks passed
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