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 { metricsProvider := metrics.Get() executorConfig, executorDB, clients, err := createExecutorParameters(c, metricsProvider) 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), metricsProvider) 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), metricsProvider) if err != nil { return fmt.Errorf("could not start client for %s", fmt.Sprintf("%s/1/rpc/%d", executorConfig.BaseOmnirpcURL, client.ChainID)) } scribeClients[client.ChainID] = append(scribeClients[client.ChainID], backendClient) } } scribe, err := node.NewScribe(eventDB, scribeClients, executorConfig.EmbeddedScribeConfig, metricsProvider) 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), metricsProvider) 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), metricsProvider).ScribeClient default: return fmt.Errorf("invalid scribe type") } handler, err := metrics.NewFromEnv(c.Context, metadata.BuildInfo()) if err != nil { return fmt.Errorf("failed to create metrics handler: %w", err) } executor, err := executor.NewExecutor(c.Context, executorConfig, executorDB, scribeClient, clients, handler) 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 ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.