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: "json", Usage: "Enable JSON output", Value: false, }, &cli.StringFlag{ Name: "lotus-api", Category: "Lotus", Usage: "Lotus RPC API endpoint", Value: "https://api.node.glif.io/rpc/v1", }, &cli.StringFlag{ Name: "lotus-token", Category: "Lotus", Usage: "Lotus RPC API token", Value: "", }, }, 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.PathCmd, }, }, }, }, { 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: func() []cli.Flag { flags := []cli.Flag{ &cli.StringFlag{ Name: "api", Usage: "URL of the metadata API", Value: "http://127.0.0.1:7777", Category: "General Options", }, &cli.StringFlag{ Name: "out-dir", Usage: "Directory to write CAR files to", Value: ".", Aliases: []string{"o"}, Category: "General Options", }, &cli.IntFlag{ Name: "concurrency", Usage: "Number of concurrent downloads", Value: 10, Aliases: []string{"j"}, Category: "General Options", }, } for _, r := range fs.Registry { if slices.Contains([]string{"crypt", "memory", "tardigrade"}, r.Prefix) { continue } cmd := datasource2.OptionsToCLIFlags(r) for _, flag := range cmd.Flags { stringFlag, ok := flag.(*cli.StringFlag) if !ok { flags = append(flags, flag) continue } stringFlag.Required = false stringFlag.Category = "Options for " + cmd.Name stringFlag.Aliases = nil flags = append(flags, stringFlag) } } return flags }(), Action: func(c *cli.Context) error { api := c.String("api") outDir := c.String("out-dir") concurrency := c.Int("concurrency") piece := c.Args().First() config := map[string]string{} for _, key := range c.LocalFlagNames() { if c.IsSet(key) { if slices.Contains([]string{"api", "out-dir", "concurrency", "o", "j"}, key) { continue } value := c.String(key) config[key] = value } } err := handler.DownloadHandler(c.Context, piece, api, config, outDir, concurrency) if err == nil { log.Logger("download").Info("Download complete") return nil } return cli.Exit(err.Error(), 1) }, }
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.