621164bc84
After iterating on the GRPC API, the changes required for the actual implementation are now included in the content store. The begin change is the move to a single, atomic `Ingester.Writer` method for locking content ingestion on a key. From this, comes several new interface definitions. The main benefit here is the clarification between `Status` and `Info` that came out of the GPRC API. `Status` tells the status of a write, whereas `Info` is for querying metadata about various blobs. Signed-off-by: Stephen J Day <stephen.day@docker.com>
39 lines
728 B
Go
39 lines
728 B
Go
package main
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
|
|
digest "github.com/opencontainers/go-digest"
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
var getCommand = cli.Command{
|
|
Name: "get",
|
|
Usage: "get the data for an object",
|
|
ArgsUsage: "[flags] [<digest>, ...]",
|
|
Description: `Display the paths to one or more blobs.
|
|
|
|
Output paths can be used to directly access blobs on disk.`,
|
|
Flags: []cli.Flag{},
|
|
Action: func(context *cli.Context) error {
|
|
cs, err := resolveContentStore(context)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
dgst, err := digest.Parse(context.Args().First())
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
rc, err := cs.Open(dgst)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer rc.Close()
|
|
|
|
_, err = io.Copy(os.Stdout, rc)
|
|
return err
|
|
},
|
|
}
|