dump

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = cli.Command{
	Name:      "dump",
	Usage:     "dump all bucket and key/value.",
	ArgsUsage: "<boltdb file>",
	Flags: []cli.Flag{
		cli.StringFlag{
			Name:  "schema",
			Value: "containerd",
			Usage: "boltdb schema: containerd,default. default is containerd.",
		},
	},
	Action: func(context *cli.Context) error {
		SrcPath := context.Args().Get(0)
		if SrcPath == "" {
			return errors.New("boltdb file need to be specified")
		}

		_, err := os.Stat(SrcPath)
		if os.IsNotExist(err) {
			return errors.New("boltdb file is not exist")
		} else if err != nil {
			return err
		}

		src, err := bolt.Open(SrcPath, 0444, nil)
		if err != nil {
			return err
		}
		defer src.Close()

		sc := context.String("schema")
		if ret := strings.Compare(sc, schema.Containerd); ret == 0 {
			err = containerdMetaPrintAll(src)
			if err != nil {
				return err
			}
		}
		return nil
	},
}

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