cmd/dist: port commands over to use GRPC content store

Following from the rest of the work in this branch, we now are porting
the dist command to work directly against the containerd content API.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2017-02-17 16:49:59 -08:00
parent 621164bc84
commit e6efb397cf
No known key found for this signature in database
GPG key ID: 67B3DED84EDC823F
6 changed files with 496 additions and 15 deletions

7
cmd/dist/ingest.go vendored
View file

@ -5,6 +5,7 @@ import (
"fmt"
"os"
contentapi "github.com/docker/containerd/api/services/content"
"github.com/docker/containerd/content"
"github.com/opencontainers/go-digest"
"github.com/urfave/cli"
@ -41,7 +42,7 @@ var ingestCommand = cli.Command{
return err
}
cs, err := resolveContentStore(context)
conn, err := connectGRPC(context)
if err != nil {
return err
}
@ -50,9 +51,11 @@ var ingestCommand = cli.Command{
return fmt.Errorf("must specify a transaction reference")
}
ingester := content.NewIngesterFromClient(contentapi.NewContentClient(conn))
// TODO(stevvooe): Allow ingest to be reentrant. Currently, we expect
// all data to be written in a single invocation. Allow multiple writes
// to the same transaction key followed by a commit.
return content.WriteBlob(ctx, cs, os.Stdin, ref, expectedSize, expectedDigest)
return content.WriteBlob(ctx, ingester, os.Stdin, ref, expectedSize, expectedDigest)
},
}