allow content to be pulled for specific platform(s), all platforms

Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
This commit is contained in:
Jess Valarezo
2018-03-12 17:31:42 -07:00
parent f334749967
commit c3cf3d7822
9 changed files with 173 additions and 38 deletions

View File

@@ -52,6 +52,21 @@ func WithDialOpts(opts []grpc.DialOption) ClientOpt {
// RemoteOpt allows the caller to set distribution options for a remote
type RemoteOpt func(*Client, *RemoteContext) error
// WithPlatform allows the caller to specify a platform to retrieve
// content for
func WithPlatform(platform string) RemoteOpt {
return func(_ *Client, c *RemoteContext) error {
for _, p := range c.Platforms {
if p == platform {
return nil
}
}
c.Platforms = append(c.Platforms, platform)
return nil
}
}
// WithPullUnpack is used to unpack an image after pull. This
// uses the snapshotter, content store, and diff service
// configured for the client.