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>
73 lines
1.3 KiB
Go
73 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
contextpkg "context"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/Sirupsen/logrus"
|
|
"github.com/docker/containerd"
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
var (
|
|
background = contextpkg.Background()
|
|
)
|
|
|
|
func main() {
|
|
app := cli.NewApp()
|
|
app.Name = "dist"
|
|
app.Version = containerd.Version
|
|
app.Usage = `
|
|
___ __
|
|
____/ (_)____/ /_
|
|
/ __ / / ___/ __/
|
|
/ /_/ / (__ ) /_
|
|
\__,_/_/____/\__/
|
|
|
|
distribution tool
|
|
`
|
|
app.Flags = []cli.Flag{
|
|
cli.BoolFlag{
|
|
Name: "debug",
|
|
Usage: "enable debug output in logs",
|
|
},
|
|
cli.DurationFlag{
|
|
Name: "timeout",
|
|
Usage: "total timeout for fetch",
|
|
EnvVar: "CONTAINERD_FETCH_TIMEOUT",
|
|
},
|
|
cli.StringFlag{
|
|
Name: "root",
|
|
Usage: "path to content store root",
|
|
Value: "/tmp/content", // TODO(stevvooe): for now, just use the PWD/.content
|
|
},
|
|
}
|
|
app.Commands = []cli.Command{
|
|
fetchCommand,
|
|
ingestCommand,
|
|
activeCommand,
|
|
getCommand,
|
|
deleteCommand,
|
|
listCommand,
|
|
applyCommand,
|
|
}
|
|
app.Before = func(context *cli.Context) error {
|
|
var (
|
|
debug = context.GlobalBool("debug")
|
|
timeout = context.GlobalDuration("timeout")
|
|
)
|
|
if debug {
|
|
logrus.SetLevel(logrus.DebugLevel)
|
|
}
|
|
|
|
if timeout > 0 {
|
|
background, _ = contextpkg.WithTimeout(background, timeout)
|
|
}
|
|
return nil
|
|
}
|
|
if err := app.Run(os.Args); err != nil {
|
|
fmt.Fprintf(os.Stderr, "dist: %s\n", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|