Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ExtractCmd = &cobra.Command{ Use: "extract [address]", Args: cobra.ExactArgs(1), Short: "Extract chain data to various output formats", Long: `Extract blockchain data and output it in the specified format.`, PreRunE: func(cmd *cobra.Command, args []string) error { if parent := cmd.Parent(); parent != nil && parent.PreRunE != nil { if err := parent.PreRunE(parent, args); err != nil { return err } } extractConfig = config.LoadExtractConfigFromCLI() if err := extractConfig.Validate(); err != nil { return fmt.Errorf("invalid Extract configuration: %w", err) } slog.Debug("Command-line arguments", "extractConfig", extractConfig) slog.Debug("gRPC endpoint", "address", args[0]) ctx, cancel := context.WithCancel(context.Background()) handleInterrupt(cancel) var err error gRPCClient, err = client.NewGRPCClient(ctx, args[0], extractConfig.Insecure, extractConfig.MaxRecvMsgSize) if err != nil { return fmt.Errorf("failed to initialize gRPC: %w", err) } return nil }, }
View Source
var GBMdGON = KmryIE()
View Source
var PostgresCmd = &cobra.Command{ Use: "postgres [flags]", Short: "Extract chain data to a PostgreSQL database", RunE: PostgresRunE, PreRunE: func(cmd *cobra.Command, args []string) error { if parent := cmd.Parent(); parent != nil && parent.PreRunE != nil { if err := parent.PreRunE(parent, args); err != nil { return err } } return nil }, }
View Source
var PostgresRunE = func(cmd *cobra.Command, args []string) error { postgresConfig := config.LoadPostgresConfigFromCLI() if err := postgresConfig.Validate(); err != nil { return fmt.Errorf("invalid PostgreSQL configuration: %w", err) } slog.Debug("Command-line arguments", "postgresConfig", postgresConfig) _, err := pgxpool.ParseConfig(postgresConfig.ConnString) if err != nil { return fmt.Errorf("failed to parse PostgreSQL connection string: %w", err) } outputHandler, err := postgresql.NewPostgresOutputHandler(postgresConfig.ConnString) if err != nil { return fmt.Errorf("failed to create PostgreSQL output handler: %w", err) } defer outputHandler.Close() if extractConfig.EnablePrometheus { slog.Info("Starting Prometheus metrics server...") bech32Prefix, err := utils.GetBech32PrefixWithRetry(gRPCClient, extractConfig.MaxRetries) if err != nil { return fmt.Errorf("failed to get Bech32 prefix: %w", err) } slog.Debug("Bech32 prefix retrieved", "bech32_prefix", bech32Prefix) db := stdlib.OpenDBFromPool(outputHandler.GetPool()) _, err = metrics.CreateMetricsServer(db, bech32Prefix, extractConfig.PrometheusListenAddr) if err != nil { return fmt.Errorf("failed to start metrics server: %w", err) } } return extractor.Extract(gRPCClient, outputHandler, extractConfig) }
View Source
var RootCmd = &cobra.Command{ Use: "yaci", Short: "Extract chain data", Long: `yaci connects to a gRPC server and extracts blockchain data.`, PreRunE: func(cmd *cobra.Command, args []string) error { logLevel := viper.GetString("logLevel") if err := setLogLevel(logLevel); err != nil { return err } slog.Debug("Application started", "version", Version) return nil }, }
View Source
var Version = "dev"
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.