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", Description: `Database Backend Support: Singularity supports multiple database backend: sqlite3, postgres, mysql5.7+ Use '--database-connection-string' or $DATABASE_CONNECTION_STRING to specify the database connection string. Example for postgres - postgres://user:pass@example.com:5432/dbname Example for mysql - mysql://user:pass@tcp(localhost:3306)/dbname?parseTime=true Example for sqlite3 - sqlite:/absolute/path/to/database.db or - sqlite:relative/path/to/database.db Network Support: Default settings in Singularity are for Mainnet. You may set below environment values for other network: For Calibration network: * Set LOTUS_API to https://api.calibration.node.glif.io/rpc/v1 * Set MARKET_DEAL_URL to https://marketdeals-calibration.s3.amazonaws.com/StateMarketDeals.json.zst For all other networks: * Set LOTUS_API to your network's Lotus API endpoint * Set MARKET_DEAL_URL to empty string Switching between different networks with the same database instance is not recommended.`, EnableBashCompletion: true, Flags: []cli.Flag{ &cli.StringFlag{ Name: "database-connection-string", Usage: "Connection string to the database", DefaultText: "sqlite:" + "./singularity.db", Value: "sqlite:" + "./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", EnvVars: []string{"LOTUS_API"}, }, &cli.StringFlag{ Name: "lotus-token", Category: "Lotus", Usage: "Lotus RPC API token", Value: "", EnvVars: []string{"LOTUS_TOKEN"}, }, &cli.BoolFlag{ Name: "lotus-test", Category: "Lotus", EnvVars: []string{"LOTUS_TEST"}, }, }, Before: func(ctx *cli.Context) error { lotusTest := ctx.Bool("lotus-test") if lotusTest { address.CurrentNetwork = address.Testnet } return nil }, Commands: []*cli.Command{ ez.PrepCmd, { Name: "admin", Usage: "Admin commands", Category: "Operations", Subcommands: []*cli.Command{ admin.InitCmd, admin.ResetCmd, admin.MigrateDatasetCmd, admin.MigrateScheduleCmd, }, }, VersionCmd, 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.DealTrackerCmd, run.DealPusherCmd, }, }, { 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, datasource.RepackCmd, { Name: "inspect", Usage: "Get preparation status of a data source", Subcommands: []*cli.Command{ inspect.PackJobsCmd, inspect.FilesCmd, inspect.DagsCmd, inspect.PackJobDetailCmd, inspect.FileDetailCmd, inspect.PathCmd, }, }, }, }, { Name: "wallet", Category: "Operations", Usage: "Wallet management", Subcommands: []*cli.Command{ wallet.ImportCmd, wallet.ListCmd, wallet.AddRemoteCmd, wallet.RemoveCmd, }, }, { Name: "tool", Category: "Tooling", Usage: "Tools used for development and debugging", Subcommands: []*cli.Command{ tool.ExtractCarCmd, }, }, }, }
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) }, }
View Source
var Version string
View Source
var VersionCmd = &cli.Command{ Name: "version", Usage: "Print version information", Aliases: []string{"v"}, Action: func(context *cli.Context) error { buildInfo, ok := debug.ReadBuildInfo() if !ok { fmt.Println("unknown version") } version := buildInfo.Main.Version if version == "(devel)" { version = Version } var revision string var modified string for _, setting := range buildInfo.Settings { switch setting.Key { case "vcs.revision": revision = setting.Value[:7] case "vcs.modified": modified = setting.Value } } if revision == "" { revision = "-unknown" } else { revision = "-" + revision } switch modified { case "true": modified = "-dirty" case "false": modified = "" case "": modified = "-unknown" default: modified = "-" + modified } fmt.Printf("singularity %s%s%s\n", version, revision, modified) return nil }, }
Functions ¶
func RunArgsInTest ¶ added in v0.1.0
func RunArgsInTestNoCapture ¶ added in v0.3.0
func SetVersion ¶ added in v0.3.0
func SetupHelpPager ¶ added in v0.3.0
func SetupHelpPager()
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.