MCPcopy
hub / github.com/containerd/containerd / WithUnpackPlatform

Function WithUnpackPlatform

core/unpack/unpacker.go:112–135  ·  view source on GitHub ↗
(u Platform)

Source from the content-addressed store, hash-verified

110type UnpackerOpt func(*unpackerConfig) error
111
112func WithUnpackPlatform(u Platform) UnpackerOpt {
113 return UnpackerOpt(func(c *unpackerConfig) error {
114 if u.Platform == nil {
115 u.Platform = platforms.All
116 }
117 if u.Snapshotter == nil {
118 return fmt.Errorf("snapshotter must be provided to unpack")
119 }
120 if u.SnapshotterKey == "" {
121 if s, ok := u.Snapshotter.(fmt.Stringer); ok {
122 u.SnapshotterKey = s.String()
123 } else {
124 u.SnapshotterKey = "unknown"
125 }
126 }
127 if u.Applier == nil {
128 return fmt.Errorf("applier must be provided to unpack")
129 }
130
131 c.platforms = append(c.platforms, &u)
132
133 return nil
134 })
135}
136
137func WithLimiter(l Limiter) UnpackerOpt {
138 return UnpackerOpt(func(c *unpackerConfig) error {

Callers 4

PullMethod · 0.92
pullMethod · 0.92
importStreamMethod · 0.92
unpackImageFunction · 0.92

Calls 2

UnpackerOptFuncType · 0.85
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…