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

Updated oci-spec-rs to 0.5.1 or later #303

Merged
merged 13 commits into from Sep 27, 2021

Conversation

guni1192
Copy link
Contributor

ref: #299

Apply builder pattern.

Getter

- let y = linux_xxx.y
+ let y = linux_xxx.y()

Builder

- let x = LinuxXXX { y: y };
+ let x = LinuxXXXBuilder::default().y(y).build().unwrap();

@yihuaf yihuaf mentioned this pull request Sep 18, 2021
4 tasks
Signed-off-by: Takashi IIGUNI <iiguni.tks@gmail.com>
Signed-off-by: Takashi IIGUNI <iiguni.tks@gmail.com>
Signed-off-by: Takashi IIGUNI <iiguni.tks@gmail.com>
@guni1192
Copy link
Contributor Author

@utam0k
It seems that if you use a different version of oci-spec-rs, you can't build cargo.
Therefore, can I update youki's oci-spec-rs in this PR?

error[E0308]: mismatched types
   --> src/container/builder_impl.rs:161:28
    |
161 |                 resources: linux.resources.clone().unwrap(),
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `oci_spec::runtime::linux::LinuxResources`, found struct `LinuxResources`
    |
    = note: perhaps two different versions of crate `oci_spec` are being used?

@utam0k
Copy link
Member

utam0k commented Sep 19, 2021

@utam0k
It seems that if you use a different version of oci-spec-rs, you can't build cargo.
Therefore, can I update youki's oci-spec-rs in this PR?

error[E0308]: mismatched types
   --> src/container/builder_impl.rs:161:28
    |
161 |                 resources: linux.resources.clone().unwrap(),
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `oci_spec::runtime::linux::LinuxResources`, found struct `LinuxResources`
    |
    = note: perhaps two different versions of crate `oci_spec` are being used?

Oh... Can I ask you to implement it in this PR?

@guni1192
Copy link
Contributor Author

@utam0k I see. I'll try it.

Signed-off-by: Takashi IIGUNI <iiguni.tks@gmail.com>
Signed-off-by: Takashi IIGUNI <iiguni.tks@gmail.com>
Signed-off-by: Takashi IIGUNI <iiguni.tks@gmail.com>
Signed-off-by: Takashi IIGUNI <iiguni.tks@gmail.com>
Signed-off-by: Takashi IIGUNI <iiguni.tks@gmail.com>
Signed-off-by: Takashi IIGUNI <iiguni.tks@gmail.com>
Signed-off-by: Takashi IIGUNI <iiguni.tks@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Sep 25, 2021

Codecov Report

Merging #303 (30459f4) into main (4224d56) will decrease coverage by 0.45%.
The diff coverage is 74.39%.

@@            Coverage Diff             @@
##             main     #303      +/-   ##
==========================================
- Coverage   71.14%   70.69%   -0.46%     
==========================================
  Files          46       46              
  Lines        6828     6702     -126     
==========================================
- Hits         4858     4738     -120     
+ Misses       1970     1964       -6     

@guni1192 guni1192 changed the title [WIP] Updated cgroups oci-spec-rs to 0.5.1 Updated cgroups oci-spec-rs to 0.5.1 or later Sep 25, 2021
@guni1192 guni1192 marked this pull request as ready for review September 25, 2021 01:37
Copy link
Collaborator

@yihuaf yihuaf 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 a consideration in the future, we should implement From spec to spec builder, so we don't have boilerplate code to copy a spec. It is error prune since we have to copy every field with a default builder.

Cargo.toml Show resolved Hide resolved
cgroups/src/v1/memory.rs Show resolved Hide resolved
cgroups/src/v1/memory.rs Show resolved Hide resolved
if let Some(pids) = &controller_opt.resources.pids {
return Some(pids);
}
fn needs_to_handle<'a>(_controller_opt: &'a ControllerOpt) -> Option<&'a Self::Resource> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same thing.

src/container/tenant_builder.rs Show resolved Hide resolved
src/container/tenant_builder.rs Outdated Show resolved Hide resolved
Signed-off-by: Takashi IIGUNI <iiguni.tks@gmail.com>
Signed-off-by: Takashi IIGUNI <iiguni.tks@gmail.com>
@yihuaf yihuaf merged commit 97848f1 into containers:main Sep 27, 2021
@guni1192 guni1192 changed the title Updated cgroups oci-spec-rs to 0.5.1 or later Updated oci-spec-rs to 0.5.1 or later Sep 27, 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.

None yet

4 participants