Skip to content

Best Practice: Selectively pulling specific layer types #444

Answered by Wwwsylvia
tcinbis asked this question in Q&A
Discussion options

You must be logged in to vote

The CopyGraphOptions.FindSuccessors callback function of oras-go allows you to customize the descriptors of layers to copy. Here is an example of how ORAS CLI uses this function:

graphCopyOptions.FindSuccessors = func(ctx context.Context, fetcher content.Fetcher, node ocispec.Descriptor) ([]ocispec.Descriptor, error) {
if content.Equal(node, root) {
// skip duplicated Resolve on subject
successors, _, config, err := graph.Successors(ctx, fetcher, node)
if err != nil {
return nil, err
}
if config != nil {
successors = append(successors, *config)
}
return successors, nil

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@caozhuozi
Comment options

@Wwwsylvia
Comment options

@caozhuozi
Comment options

@Wwwsylvia
Comment options

Answer selected by tcinbis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants