cmd

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var App = &cli.App{
	Name:                 "singularity",
	Usage:                "A tool for large-scale clients with PB-scale data onboarding to Filecoin network",
	EnableBashCompletion: true,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name: "database-connection-string",
			Usage: "Connection string to the database.\n" +
				"Supported database: sqlite3, postgres, mysql\n" +
				"Example for postgres  - postgres://user:pass@example.com:5432/dbname\n" +
				"Example for mysql     - mysql://user:pass@tcp(localhost:3306)/dbname?charset=ascii&parseTime=true\n" +
				"                          Note: the database needs to be created using ascii Character Set:" +
				"                                `CREATE DATABASE <dbname> DEFAULT CHARACTER SET ascii`\n" +
				"Example for sqlite3   - sqlite:/absolute/path/to/database.db\n" +
				"            or        - sqlite:relative/path/to/database.db\n",
			DefaultText: "sqlite:" + must.String(os.UserHomeDir()) + "/.singularity/singularity.db",
			Value:       "sqlite:" + must.String(os.UserHomeDir()) + "/.singularity/singularity.db",
			EnvVars:     []string{"DATABASE_CONNECTION_STRING"},
		},
		&cli.BoolFlag{
			Name:  "verbose",
			Usage: "Enable verbose logging",
			Value: false,
		},
		&cli.BoolFlag{
			Name:  "json",
			Usage: "Enable JSON output",
			Value: false,
		},
	},
	Commands: []*cli.Command{
		ez.PrepCmd,
		{
			Name:     "admin",
			Usage:    "Admin commands",
			Category: "Operations",
			Subcommands: []*cli.Command{
				admin.InitCmd,
				admin.ResetCmd,
				admin.MigrateCmd,
			},
		},
		DownloadCmd,
		{
			Name:     "deal",
			Usage:    "Replication / Deal making management",
			Category: "Operations",
			Subcommands: []*cli.Command{
				{
					Name:  "schedule",
					Usage: "Schedule deals",
					Subcommands: []*cli.Command{
						schedule.CreateCmd,
						schedule.ListCmd,
						schedule.PauseCmd,
						schedule.ResumeCmd,
					},
				},
				{
					Name:  "spade-policy",
					Usage: "Manage SPADE policies",
					Subcommands: []*cli.Command{
						spadepolicy.CreateCmd,
						spadepolicy.ListCmd,
						spadepolicy.RemoveCmd,
					},
				},
				deal.SendManualCmd,
				deal.ListCmd,
			},
		},
		{
			Name:     "run",
			Category: "Daemons",
			Usage:    "Run different singularity components",
			Subcommands: []*cli.Command{
				run.ApiCmd,
				run.DatasetWorkerCmd,
				run.ContentProviderCmd,
				run.DealMakerCmd,
				run.SpadeAPICmd,
			},
		},
		{
			Name:     "dataset",
			Category: "Operations",
			Usage:    "Dataset management",
			Subcommands: []*cli.Command{
				dataset.CreateCmd,
				dataset.ListDatasetCmd,
				dataset.UpdateCmd,
				dataset.RemoveDatasetCmd,
				dataset.AddWalletCmd,
				dataset.ListWalletCmd,
				dataset.RemoveWalletCmd,
				dataset.AddPieceCmd,
				dataset.ListPiecesCmd,
			},
		},
		{
			Name:     "datasource",
			Category: "Operations",
			Usage:    "Data source management",
			Subcommands: []*cli.Command{
				datasource.AddCmd,
				datasource.ListCmd,
				datasource.StatusCmd,
				datasource.RemoveCmd,
				datasource.CheckCmd,
				datasource.UpdateCmd,
				datasource.RescanCmd,
				datasource.DagGenCmd,
				{
					Name:  "inspect",
					Usage: "Get preparation status of a data source",
					Subcommands: []*cli.Command{
						inspect.ChunksCmd,
						inspect.ItemsCmd,
						inspect.DagsCmd,
						inspect.ChunkDetailCmd,
						inspect.ItemDetailCmd,
						inspect.DirCmd,
					},
				},
			},
		},
		{
			Name:     "wallet",
			Category: "Operations",
			Usage:    "Wallet management",
			Subcommands: []*cli.Command{
				wallet.ImportCmd,
				wallet.ListCmd,
				wallet.AddRemoteCmd,
				wallet.RemoveCmd,
			},
		},
	},
}
View Source
var DownloadCmd = &cli.Command{
	Name:      "download",
	Usage:     "Download a CAR file from the metadata API",
	Category:  "Utility",
	ArgsUsage: "PIECE_CID",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:  "api",
			Usage: "URL of the metadata API",
			Value: "http://127.0.0.1:9090",
		},
		&cli.StringSliceFlag{
			Name:     "http-header",
			Category: "HTTP data source",
			Aliases:  []string{"H"},
			EnvVars:  []string{"HTTP_HEADER"},
			Usage:    "http headers to be passed with the request (i.e. key=value). The value shoud not be encoded",
		},
		&cli.StringFlag{
			Name:     "s3-endpoint",
			Usage:    "Custom S3 endpoint",
			Category: "S3 data source",
			EnvVars:  []string{"S3_ENDPOINT"},
		},
		&cli.StringFlag{
			Name:     "s3-region",
			Usage:    "S3 region to use with AWS S3",
			Category: "S3 data source",
			EnvVars:  []string{"S3_REGION"},
		},
		&cli.StringFlag{
			Name:     "s3-access-key-id",
			Usage:    "IAM access key ID",
			Category: "S3 data source",
			EnvVars:  []string{"AWS_ACCESS_KEY_ID"},
		},
		&cli.StringFlag{
			Name:     "s3-secret-access-key",
			Usage:    "IAM secret access key",
			Category: "S3 data source",
			EnvVars:  []string{"AWS_SECRET_ACCESS_KEY"},
		},
	},
	Action: func(c *cli.Context) error {
		piece := c.Args().First()
		api := c.String("api")
		return handler.DownloadHandler(piece, api, nil)
	},
}

Functions

func RunApp added in v0.1.0

func RunApp(ctx context.Context, args []string) error

func RunArgsInTest added in v0.1.0

func RunArgsInTest(ctx context.Context, args string) (string, string, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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