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

Revisit file.PackFiles() #345

Closed
Wwwsylvia opened this issue Oct 18, 2022 · 3 comments · Fixed by #400
Closed

Revisit file.PackFiles() #345

Wwwsylvia opened this issue Oct 18, 2022 · 3 comments · Fixed by #400
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Wwwsylvia
Copy link
Member

Wwwsylvia commented Oct 18, 2022

file.PackFiles() allows users to add files and pack a manifest quickly. But the current design might not be perfect.
We should revisit it and think about if we should keep/refactor/deprecate it in oras-go v2.0.0.

func (s *Store) PackFiles(ctx context.Context, names []string) (ocispec.Descriptor, error) {
if s.isClosedSet() {
return ocispec.Descriptor{}, ErrStoreClosed
}
var layers []ocispec.Descriptor
for _, name := range names {
desc, err := s.Add(ctx, name, "", "")
if err != nil {
return ocispec.Descriptor{}, fmt.Errorf("failed to add %s: %w", name, err)
}
layers = append(layers, desc)
}
return oras.Pack(ctx, s, "", layers, oras.PackOptions{})

@Wwwsylvia Wwwsylvia added the enhancement New feature or request label Oct 18, 2022
@Wwwsylvia Wwwsylvia added this to the v2.0.0 milestone Oct 18, 2022
@Wwwsylvia
Copy link
Member Author

One use case of this function can be found here.

@FeynmanZhou FeynmanZhou removed their assignment Dec 13, 2022
@shizhMSFT
Copy link
Contributor

@Wwwsylvia I suggest removing this function, and adding an example instead.

@sajayantony
Copy link
Contributor

+1 to an example with just one file add to show how someone can generate a manifest and to keep the lines of code less.

shizhMSFT pushed a commit that referenced this issue Jan 12, 2023
Resolves: #345
BREAKING CHANGE: Remove `file.PackFiles()`
Signed-off-by: Lixia (Sylvia) Lei <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants