MCPcopy Index your code
hub / github.com/containerd/containerd / NewFetchConfig

Function NewFetchConfig

cmd/ctr/commands/content/fetch.go:119–154  ·  view source on GitHub ↗

NewFetchConfig returns the default FetchConfig from cli flags

(ctx context.Context, cliContext *cli.Context)

Source from the content-addressed store, hash-verified

117
118// NewFetchConfig returns the default FetchConfig from cli flags
119func NewFetchConfig(ctx context.Context, cliContext *cli.Context) (*FetchConfig, error) {
120 resolver, err := commands.GetResolver(ctx, cliContext)
121 if err != nil {
122 return nil, err
123 }
124 config := &FetchConfig{
125 Resolver: resolver,
126 Labels: cliContext.StringSlice("label"),
127 TraceHTTP: cliContext.Bool("http-trace"),
128 }
129 if !cliContext.Bool("debug") {
130 config.ProgressOutput = os.Stdout
131 }
132 if !cliContext.Bool("all-platforms") {
133 p := cliContext.StringSlice("platform")
134 if len(p) == 0 {
135 p = append(p, platforms.DefaultString())
136 }
137 config.Platforms = p
138 }
139
140 if cliContext.Bool("metadata-only") {
141 config.AllMetadata = true
142 // Any with an empty set is None
143 config.PlatformMatcher = platforms.Any()
144 } else if !cliContext.Bool("skip-metadata") {
145 config.AllMetadata = true
146 }
147
148 if cliContext.IsSet("max-concurrent-uploaded-layers") {
149 mcu := cliContext.Int("max-concurrent-uploaded-layers")
150 config.RemoteOpts = append(config.RemoteOpts, containerd.WithMaxConcurrentUploadedLayers(mcu))
151 }
152
153 return config, nil
154}
155
156// Fetch loads all resources into the content store and returns the image
157func Fetch(ctx context.Context, client *containerd.Client, ref string, config *FetchConfig) (images.Image, error) {

Callers 2

pull.goFile · 0.92
fetch.goFile · 0.85

Calls 1

GetResolverFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…