run

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ApiCmd = &cli.Command{
		Name:  "api",
		Usage: "Run the singularity API",
		Flags: []cli.Flag{
			&cli.StringFlag{
				Name:  "bind",
				Usage: "Bind address for the API server",
				Value: "127.0.0.1:9090",
			},
		},
		Action: api.Run,
	}
)
View Source
var ContentProviderCmd = &cli.Command{
	Name:  "content-provider",
	Usage: "Start a content provider that serves retrieval requests",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:  "http-bind",
			Usage: "Address to bind the HTTP server to",
			Value: "127.0.0.1:8088",
		},
		&cli.StringFlag{
			Name:        "identity-key",
			Usage:       "The base64 encoded private key for libp2p peer",
			Value:       "",
			DefaultText: "AutoGenerated",
		},
		&cli.StringSliceFlag{
			Name:        "libp2p-listen",
			Usage:       "Addresses to listen on for libp2p connections",
			DefaultText: "AutoDetect",
		},
	},
	Action: func(c *cli.Context) error {
		db := database.MustOpenFromCLI(c)
		err := model.AutoMigrate(db)
		if err != nil {
			return handler.NewHandlerError(err)
		}

		s, err := service.NewContentProviderService(db, c.String("http-bind"),
			c.String("identity-key"),
			c.StringSlice("libp2p-listen"))
		if err != nil {
			return cli.Exit(err.Error(), 1)
		}
		s.Start()
		return nil
	},
}
View Source
var DatasetWorkerCmd = &cli.Command{
	Name:  "dataset-worker",
	Usage: "Start a dataset preparation worker to process dataset scanning and preparation tasks",
	Flags: []cli.Flag{
		&cli.IntFlag{
			Name:    "concurrency",
			Usage:   "Number of concurrent workers to run",
			EnvVars: []string{"DATASET_WORKER_CONCURRENCY"},
			Value:   1,
		},
		&cli.BoolFlag{
			Name:    "enable-scan",
			Usage:   "Enable scanning of datasets",
			EnvVars: []string{"DATASET_WORKER_ENABLE_SCAN"},
			Value:   true,
		},
		&cli.BoolFlag{
			Name:    "enable-pack",
			Usage:   "Enable packing of datasets that calculates CIDs and packs them into CAR files",
			EnvVars: []string{"DATASET_WORKER_ENABLE_PACK"},
			Value:   true,
		},
		&cli.BoolFlag{
			Name:    "enable-dag",
			Usage:   "Enable dag generation of datasets that maintains the directory structure of datasets",
			EnvVars: []string{"DATASET_WORKER_ENABLE_DAG"},
			Value:   true,
		},
		&cli.BoolFlag{
			Name:    "exit-on-complete",
			Usage:   "Exit the worker when there is no more work to do",
			EnvVars: []string{"DATASET_WORKER_EXIT_ON_COMPLETE"},
			Value:   false,
		},
		&cli.BoolFlag{
			Name:    "exit-on-error",
			Usage:   "Exit the worker when there is any error",
			EnvVars: []string{"DATASET_WORKER_EXIT_ON_ERROR"},
			Value:   false,
		},
	},
	Action: func(c *cli.Context) error {
		db := database.MustOpenFromCLI(c)
		err := model.AutoMigrate(db)
		if err != nil {
			return handler.NewHandlerError(err)
		}
		worker := datasetworker.NewDatasetWorker(
			db,
			datasetworker.DatasetWorkerConfig{
				Concurrency:    c.Int("concurrency"),
				EnableScan:     c.Bool("enable-scan"),
				EnablePack:     c.Bool("enable-pack"),
				EnableDag:      c.Bool("enable-dag"),
				ExitOnComplete: c.Bool("exit-on-complete"),
				ExitOnError:    c.Bool("exit-on-error"),
			})
		err = worker.Run(c.Context)
		if err != nil {
			return err
		}
		return nil
	},
}
View Source
var DealMakerCmd = &cli.Command{
	Name:  "dealmaker",
	Usage: "Start a deal making/tracking worker to process deal making",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:     "lotus-api",
			Category: "Lotus",
			Usage:    "Lotus RPC API endpoint, only used to get miner info",
			Value:    "https://api.node.glif.io/rpc/v1",
		},
		&cli.StringFlag{
			Name:     "lotus-token",
			Category: "Lotus",
			Usage:    "Lotus RPC API token, only used to get miner info",
			Value:    "",
		},
	},
	Action: func(c *cli.Context) error {
		db := database.MustOpenFromCLI(c)
		err := model.AutoMigrate(db)
		if err != nil {
			return handler.NewHandlerError(err)
		}
		dealMaker, err := service.NewDealMakerService(db, c.String("lotus-api"), c.String("lotus-token"))
		if err != nil {
			return cli.Exit(err.Error(), 1)
		}
		return dealMaker.Run(c.Context)
	},
}
View Source
var SpadeAPICmd = &cli.Command{
	Name:  "spade-api",
	Usage: "Start a Spade compatible API for storage provider deal proposal self service",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:  "bind",
			Usage: "Bind address for the API server",
			Value: "127.0.0.1:9091",
		},
		&cli.StringFlag{
			Name:     "lotus-api",
			Category: "Lotus",
			Usage:    "Lotus RPC API endpoint, only used to get miner info",
			Value:    "https://api.node.glif.io/rpc/v1",
		},
		&cli.StringFlag{
			Name:     "lotus-token",
			Category: "Lotus",
			Usage:    "Lotus RPC API token, only used to get miner info",
			Value:    "",
		},
	},
	Action: func(c *cli.Context) error {
		db := database.MustOpenFromCLI(c)
		err := model.AutoMigrate(db)
		if err != nil {
			return handler.NewHandlerError(err)
		}

		h, err := util.InitHost(context.Background(), nil)
		if err != nil {
			return err
		}

		dealMaker, err := replication.NewDealMaker(c.String("lotus-api"), c.String("lotus-token"), h)
		if err != nil {
			return err
		}

		return service.NewSpadeAPIService(db, dealMaker, &replication.WalletChooser{}, c.String("bind")).Start()
	},
}

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