status

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChunksCmd = &cli.Command{
	Name:      "chunks",
	Usage:     "Get all chunk details of a data source",
	ArgsUsage: "<source_id>",
	Action: func(c *cli.Context) error {
		db := database.MustOpenFromCLI(c)
		result, err := status.GetSourceChunksHandler(
			db,
			c.Args().Get(0),
		)
		if err != nil {
			return err.CliError()
		}

		cliutil.PrintToConsole(result, c.Bool("json"))
		return nil
	},
}
View Source
var ItemsCmd = &cli.Command{
	Name:        "items",
	Usage:       "Get all item details of a data source",
	ArgsUsage:   "<source_id>",
	Description: "This command will list all items in a data source. This may be very large if not filtered by chunk id.",
	Flags: []cli.Flag{
		&cli.UintFlag{
			Name:  "chunk-id",
			Usage: "Filter by chunk ID",
		},
	},
	Action: func(c *cli.Context) error {
		db := database.MustOpenFromCLI(c)
		result, err := status.GetSourceItemsHandler(
			db,
			c.Args().Get(0),
			c.String("chunk-id"),
		)
		if err != nil {
			return err.CliError()
		}

		cliutil.PrintToConsole(result, c.Bool("json"))
		return nil
	},
}
View Source
var SummaryCmd = &cli.Command{
	Name:      "summary",
	Usage:     "Get the data preparation summary of a data source",
	ArgsUsage: "<source_id>",
	Action: func(c *cli.Context) error {
		db := database.MustOpenFromCLI(c)
		result, err := status.GetSourceSummaryHandler(
			db,
			c.Args().Get(0),
		)
		if err != nil {
			return err.CliError()
		}

		if c.Bool("json") {
			objJSON, err := json.MarshalIndent(result, "", "  ")
			if err != nil {
				return err
			}
			fmt.Println(string(objJSON))
			return nil
		}

		cliutil.PrintToConsole(result.Source, c.Bool("json"))
		cliutil.PrintToConsole(result.ChunkSummary, c.Bool("json"))
		cliutil.PrintToConsole(result.ItemSummary, c.Bool("json"))
		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