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

Remove Factory and LinuxFactory #3373

Merged
merged 6 commits into from
Mar 23, 2022

Conversation

kolyshkin
Copy link
Contributor

@kolyshkin kolyshkin commented Feb 11, 2022

Based on and currently includes #3374. Draft until that one is merged.

Continuing the spring cleaning started in #3354. This dismantles Factory and LinuxFactory, doing some cleanups along the way.

Loosely based on parts of #3316.

@kolyshkin kolyshkin marked this pull request as ready for review February 11, 2022 04:09
@kolyshkin kolyshkin changed the title Less interfaces Remove Factory and LinuxFactory Feb 11, 2022
@kolyshkin kolyshkin requested a review from thaJeztah February 11, 2022 04:11
This was referenced Feb 11, 2022
@kolyshkin kolyshkin marked this pull request as draft February 12, 2022 02:44
@kolyshkin kolyshkin marked this pull request as ready for review March 10, 2022 03:05
@kolyshkin
Copy link
Contributor Author

No longer a draft; PTAL @opencontainers/runc-maintainers @thaJeztah @AkihiroSuda

@kolyshkin
Copy link
Contributor Author

PTAL @opencontainers/runc-maintainers @thaJeztah @AkihiroSuda (I have a few more draft PRs on top of this).

@kolyshkin
Copy link
Contributor Author

This is mostly code removal, and is organized to ease the review as much as possible.

@kolyshkin
Copy link
Contributor Author

Anything I can do to move this forward, @opencontainers/runc-maintainers? I have a few more PRs based on top of this.

@kolyshkin kolyshkin added the kind/refactor refactoring label Mar 22, 2022
@kolyshkin kolyshkin added this to the 1.2.0 milestone Mar 22, 2022
crosbymichael
crosbymichael previously approved these changes Mar 22, 2022
//
// Returns the new container with a running process.
//
// On error, any partially created container parts are cleaned up (the
Copy link
Member

Choose a reason for hiding this comment

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

I don't see any clean-up code

// Returns the new container with a running process.
//
// On error, any partially created container parts are cleaned up (the
// operation is atomic).
Copy link
Member

@AkihiroSuda AkihiroSuda Mar 23, 2022

Choose a reason for hiding this comment

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

"atomic" might not be the right word.
"atomic" means "atomic" as in sync/atomic to me.

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's worse than that -- currently, Create does not even creates a container (with a process running inside it, as the doc says) -- it merely creates a container directory and returns some structure that can be used to actually start a container.

I'll try to modify the docs accordingly. These were just moved from factory to not lose them, but seems like it was not a good idea.

@AkihiroSuda
Copy link
Member

👍 but godoc might not be correct

Is is not used by anyone

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
It is not used by anyone.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The only implementation is LinuxFactory, let's use this directly.

Move the piece of documentation about Create from removed factory.go to
the factory_linux.go.

The LinuxFactory is to be removed later.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
StartInitialization does not have to be a method of Factory (while
it is clear why it was done that way initially, now we only have
Linux containers so it does not make sense).

Fix callers and docs accordingly.

No change in functionality.

Also, since this was the only user of libcontainer.New with the empty
string as an argument, the corresponding check can now be removed
from it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
These do not have to be methods.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Since LinuxFactory has become the means to specify containers state
top directory (aka --root), and is only used by two methods (Create
and Load), it is easier to pass root to them directly.

Modify all the users and the docs accordingly.

While at it, fix Create and Load docs (those that were originally moved
from the Factory interface docs).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah thaJeztah merged commit eba9367 into opencontainers:main Mar 23, 2022
@kolyshkin kolyshkin deleted the less-interfaces branch April 5, 2023 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/refactor refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants