commands

package
v0.0.0-...-84b6aa6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BuildCmd = &cobra.Command{
		Use:   "build -o  <target> <source>",
		Short: "Build a FILEgrain image",
		RunE: func(cmd *cobra.Command, args []string) error {
			if buildCmdConfig.target == "" {
				return errors.New("must specify target output (-o)")
			}
			if len(args) != 1 {
				return errors.New("must specify source")
			}
			source := args[0]
			b, err := newBuilder(buildCmdConfig.sourceType, source)
			if err != nil {
				return err
			}
			if err := b.Build(buildCmdConfig.target, buildCmdConfig.refName); err != nil {
				return err
			}
			logrus.Info("Done")
			return nil
		},
	}
)
View Source
var (
	MainCmd = &cobra.Command{
		Use:   "filegrain <command>",
		Short: "FILEgrain: transport-agnostic, fine-grained content-addressable container image layout",
		PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
			if mainCmdConfig.debug {
				logrus.SetLevel(logrus.DebugLevel)
				logrus.Debug("running in debug mode")
			}
			return nil
		},
	}
)
View Source
var (
	MountCmd = &cobra.Command{
		Use:   "mount <image> <mountpoint>",
		Short: "Mount with lazy fs",
		RunE: func(cmd *cobra.Command, args []string) error {
			if len(args) != 2 {
				return errors.New("must specify image and mountpoint")
			}
			img, mountpoint := args[0], args[1]
			cachePath, err := ioutil.TempDir("", "filegrain-blobcache")
			if err != nil {
				return err
			}
			logrus.Infof("Blob cache (ephemeral): %s", cachePath)
			defer os.RemoveAll(cachePath)
			pvller, err := puller.NewBlobCacher(cachePath,
				puller.NewLocalPuller())
			if err != nil {
				return err
			}
			opts := lazyfs.Options{
				Mountpoint: mountpoint,
				Puller:     pvller,
				Image:      img,
				RefName:    mountCmdConfig.refName,
			}
			return serve(opts)
		},
	}
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL