Documentation ¶
Overview ¶
Package cmd provides the command line interface for the executor.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ExecutorInfoCommand = &cli.Command{ Name: "executor-info", Description: "learn how to use executor cli", Action: func(c *cli.Context) error { fmt.Println(string(markdown.Render(help, termsize.Width(), 6))) return nil }, }
ExecutorInfoCommand gets info about using the executor agent.
View Source
var ExecutorRunCommand = &cli.Command{ Name: "executor-run", Description: "runs the executor service", Flags: []cli.Flag{configFlag, dbFlag, pathFlag, scribeTypeFlag, metricsPortFlag, scribeDBFlag, scribePathFlag, scribePortFlag, scribeURL}, Action: func(c *cli.Context) error { executorConfig, executorDB, clients, err := createExecutorParameters(c) if err != nil { return err } var scribeClient client.ScribeClient g, _ := errgroup.WithContext(c.Context) switch c.String(scribeTypeFlag.Name) { case "embedded": eventDB, err := scribeAPI.InitDB(c.Context, c.String(scribeDBFlag.Name), c.String(scribePathFlag.Name)) if err != nil { return fmt.Errorf("failed to initialize database: %w", err) } scribeClients := make(map[uint32][]backfill.ScribeBackend) for _, client := range executorConfig.EmbeddedScribeConfig.Chains { for confNum := 1; confNum <= scribeCmd.MaxConfirmations; confNum++ { backendClient, err := backfill.DialBackend(c.Context, fmt.Sprintf("%s/%d/rpc/%d", executorConfig.BaseOmnirpcURL, confNum, client.ChainID)) if err != nil { return fmt.Errorf("could not start client for %s", fmt.Sprintf("%s/%d/rpc/%d", executorConfig.BaseOmnirpcURL, confNum, client.ChainID)) } scribeClients[client.ChainID] = append(scribeClients[client.ChainID], backendClient) } } scribe, err := node.NewScribe(eventDB, scribeClients, executorConfig.EmbeddedScribeConfig) if err != nil { return fmt.Errorf("failed to initialize scribe: %w", err) } g.Go(func() error { err := scribe.Start(c.Context) if err != nil { return fmt.Errorf("failed to start scribe: %w", err) } return nil }) embedded := client.NewEmbeddedScribe(c.String(scribeDBFlag.Name), c.String(scribePathFlag.Name)) g.Go(func() error { err := embedded.Start(c.Context) if err != nil { return fmt.Errorf("failed to start embedded scribe: %w", err) } return nil }) scribeClient = embedded.ScribeClient case "remote": scribeClient = client.NewRemoteScribe(uint16(c.Uint(scribePortFlag.Name)), c.String(scribeURL.Name)).ScribeClient default: return fmt.Errorf("invalid scribe type") } executor, err := executor.NewExecutor(c.Context, executorConfig, executorDB, scribeClient, clients) if err != nil { return fmt.Errorf("failed to create executor: %w", err) } g.Go(func() error { err := api.Start(c.Context, uint16(c.Uint(metricsPortFlag.Name))) if err != nil { return fmt.Errorf("failed to start api: %w", err) } return nil }) g.Go(func() error { err := executor.Run(c.Context) if err != nil { return fmt.Errorf("failed to run executor: %w", err) } return nil }) if err := g.Wait(); err != nil { return fmt.Errorf("failed to run executor: %w", err) } return nil }, }
ExecutorRunCommand runs the executor.
Functions ¶
func InitExecutorDB ¶
func InitExecutorDB(ctx context.Context, database string, path string, tablePrefix string) (db.ExecutorDB, error)
InitExecutorDB initializes a database given a database type and path.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.