Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AddPieceCmd = &cli.Command{ Name: "add-piece", Usage: "Manually register a piece (CAR file) with the dataset for deal making purpose", ArgsUsage: "<dataset_name> <piece_cid> <piece_size>", Flags: []cli.Flag{ &cli.StringFlag{ Name: "file-path", Usage: "Path to the CAR file, used to determine the size of the file and root CID", Aliases: []string{"p"}, }, &cli.Uint64Flag{ Name: "file-size", Usage: "Size of the CAR file, if not provided, will be determined by the CAR file", Aliases: []string{"s"}, }, &cli.StringFlag{ Name: "root-cid", Usage: "Root CID of the CAR file, if not provided, will be determined by the CAR file header. Used to populate the label field of storage deal", Aliases: []string{"r"}, }, }, Action: func(c *cli.Context) error { db := database.MustOpenFromCLI(c) car, err := dataset.AddPieceHandler( db, c.Args().Get(0), dataset.AddPieceRequest{ PieceCID: c.Args().Get(1), PieceSize: c.Args().Get(2), FilePath: c.String("file-path"), FileSize: c.Uint64("file-size"), RootCID: c.String("root-cid"), }, ) if err != nil { return err.CliError() } cliutil.PrintToConsole(car, c.Bool("json"), nil) return nil }, }
View Source
var AddWalletCmd = &cli.Command{ Name: "add-wallet", Usage: "Associate a wallet with the dataset. The wallet needs to be imported first using the `singularity wallet import` command.", ArgsUsage: "DATASET_NAME WALLET_ADDRESS", Action: func(c *cli.Context) error { db := database.MustOpenFromCLI(c) wallet, err := wallet.AddWalletHandler(db, c.Args().Get(0), c.Args().Get(1)) if err != nil { return err.CliError() } cliutil.PrintToConsole(wallet, c.Bool("json"), nil) return nil }, }
View Source
var CreateCmd = &cli.Command{ Name: "create", Usage: "Create a new dataset", ArgsUsage: "<dataset_name>", Description: "<dataset_name> must be a unique identifier for a dataset\n" + "The dataset is a top level object to distinguish different dataset.", Flags: []cli.Flag{ &cli.StringFlag{ Name: "max-size", Aliases: []string{"M"}, Usage: "Maximum size of the CAR files to be created", Value: "31.5GiB", Category: "Preparation Parameters", }, &cli.StringFlag{ Name: "piece-size", Aliases: []string{"s"}, Usage: "Target piece size of the CAR files used for piece commitment calculation", DefaultText: "inferred", Category: "Preparation Parameters", }, &cli.StringSliceFlag{ Name: "output-dir", Aliases: []string{"o"}, Usage: "Output directory for CAR files", DefaultText: "not needed", Category: "Inline Preparation", }, &cli.StringSliceFlag{ Name: "encryption-recipient", Usage: "Public key of the encryption recipient", Category: "Encryption", }, &cli.StringFlag{ Name: "encryption-script", Usage: "[WIP] EncryptionScript command to run for custom encryption", Category: "Encryption", }, }, Action: func(c *cli.Context) error { db := database.MustOpenFromCLI(c) dataset, err := dataset.CreateHandler( db, dataset.CreateRequest{ Name: c.Args().Get(0), MaxSizeStr: c.String("max-size"), PieceSizeStr: c.String("piece-size"), OutputDirs: c.StringSlice("output-dir"), EncryptionRecipients: c.StringSlice("encryption-recipient"), EncryptionScript: c.String("encryption-script")}, ) if err != nil { return err } cliutil.PrintToConsole(dataset, c.Bool("json"), nil) return nil }, }
View Source
var ListDatasetCmd = &cli.Command{ Name: "list", Usage: "List all datasets", Action: func(c *cli.Context) error { db := database.MustOpenFromCLI(c) datasets, err := dataset.ListHandler( db, ) if err != nil { return err } cliutil.PrintToConsole(datasets, c.Bool("json"), nil) return nil }, }
View Source
var ListPiecesCmd = &cli.Command{ Name: "list-pieces", Usage: "List all pieces for the dataset that are available for deal making", ArgsUsage: "<dataset_name>", Action: func(c *cli.Context) error { db := database.MustOpenFromCLI(c) car, err := dataset.ListPiecesHandler( db, c.Args().Get(0), ) if err != nil { return err.CliError() } cliutil.PrintToConsole(car, c.Bool("json"), nil) return nil }, }
View Source
var ListWalletCmd = &cli.Command{ Name: "list-wallet", Usage: "List all associated wallets with the dataset", ArgsUsage: "DATASET_NAME", Action: func(c *cli.Context) error { db := database.MustOpenFromCLI(c) wallets, err := wallet.ListWalletHandler(db, c.Args().Get(0)) if err != nil { return err.CliError() } cliutil.PrintToConsole(wallets, c.Bool("json"), nil) return nil }, }
View Source
var RemoveDatasetCmd = &cli.Command{ Name: "remove", Usage: "Remove a specific dataset. This will not remove the CAR files.", Description: "Important! If the dataset is large, this command will take some time to remove all relevant data.", ArgsUsage: "<dataset_name>", Action: func(c *cli.Context) error { db := database.MustOpenFromCLI(c) err := dataset.RemoveHandler( db, c.Args().Get(0), ) if err != nil { return err.CliError() } return nil }, }
View Source
var RemoveWalletCmd = &cli.Command{ Name: "remove-wallet", Usage: "Remove an associated wallet from the dataset", ArgsUsage: "DATASET_NAME WALLET_ADDRESS", Action: func(c *cli.Context) error { db := database.MustOpenFromCLI(c) err := wallet.RemoveWalletHandler(db, c.Args().Get(0), c.Args().Get(1)) if err != nil { return err.CliError() } return nil }, }
View Source
var UpdateCmd = &cli.Command{ Name: "update", Usage: "Update an existing dataset", ArgsUsage: "<dataset_name>", Flags: []cli.Flag{ &cli.StringFlag{ Name: "max-size", Aliases: []string{"M"}, Usage: "Maximum size of the CAR files to be created", Value: "30GiB", Category: "Preparation Parameters", }, &cli.StringFlag{ Name: "piece-size", Aliases: []string{"s"}, Usage: "Target piece size of the CAR files used for piece commitment calculation", DefaultText: "inferred", Category: "Preparation Parameters", }, &cli.StringSliceFlag{ Name: "output-dir", Aliases: []string{"o"}, Usage: "Output directory for CAR files", DefaultText: "not needed", Category: "Inline Preparation", }, &cli.StringSliceFlag{ Name: "encryption-recipient", Usage: "Public key of the encryption recipient", Category: "Encryption", }, &cli.StringFlag{ Name: "encryption-script", Usage: "EncryptionScript command to run for custom encryption", Category: "Encryption", }, }, Action: func(c *cli.Context) error { db := database.MustOpenFromCLI(c) var maxSizeStr *string if c.IsSet("max-size") { s := c.String("max-size") maxSizeStr = &s } var pieceSizeStr *string if c.IsSet("piece-size") { s := c.String("piece-size") pieceSizeStr = &s } var encryptionScript *string if c.IsSet("encryption-script") { s := c.String("encryption-script") encryptionScript = &s } dataset, err := dataset.UpdateHandler( db, c.Args().Get(0), dataset.UpdateRequest{ MaxSizeStr: maxSizeStr, PieceSizeStr: pieceSizeStr, OutputDirs: c.StringSlice("output-dir"), EncryptionRecipients: c.StringSlice("encryption-recipients"), EncryptionScript: encryptionScript, }, ) if err != nil { return err } cliutil.PrintToConsole(dataset, c.Bool("json"), nil) return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.