cmd/dist, remotes: break out docker resolver

Allow usage of the experimental docker resolver as a package. There are
very few changes to the consuming code, demonstrating the effectiveness
of the abstraction. This move will allow future contributions to a more
featured resolver implementation.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2017-03-21 16:52:22 -07:00
parent 4cc7cddf4b
commit e1a361bff2
No known key found for this signature in database
GPG key ID: 67B3DED84EDC823F
5 changed files with 314 additions and 302 deletions

8
cmd/dist/common.go vendored
View file

@ -1,6 +1,7 @@
package main
import (
"context"
"net"
"path/filepath"
"time"
@ -8,6 +9,8 @@ import (
"github.com/boltdb/bolt"
"github.com/docker/containerd/content"
"github.com/docker/containerd/images"
"github.com/docker/containerd/remotes"
"github.com/docker/containerd/remotes/docker"
"github.com/urfave/cli"
"google.golang.org/grpc"
)
@ -57,3 +60,8 @@ func getDB(ctx *cli.Context, readonly bool) (*bolt.DB, error) {
return db, nil
}
// getResolver prepares the resolver from the environment and options.
func getResolver(ctx context.Context) (remotes.Resolver, error) {
return docker.NewResolver(), nil
}