app

package
v0.0.0-...-ff78b6e Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: GPL-3.0 Imports: 62 Imported by: 0

Documentation

Overview

Package app contains framework for building a command-line based Erigon node.

Index

Constants

View Source
const Version = 1

Variables

View Source
var (
	ToDatadirFlag = flags.DirectoryFlag{
		Name:     "to.datadir",
		Usage:    "Target datadir",
		Required: true,
	}
	BackupLabelsFlag = cli.StringFlag{
		Name:  "lables",
		Usage: "Name of component to backup. Example: chaindata,txpool,downloader",
	}
	BackupTablesFlag = cli.StringFlag{
		Name:  "tables",
		Usage: "One of: PlainState,HashedState",
	}
	BackupToPageSizeFlag = cli.StringFlag{
		Name:  "to.pagesize",
		Usage: utils.DbPageSizeFlag.Usage,
	}
	WarmupThreadsFlag = cli.Uint64Flag{
		Name: "warmup.threads",
		Usage: `Erigon's db works as blocking-io: means it stops when read from disk. 
It means backup speed depends on 'disk latency' (not throughput). 
Can spawn many threads which will read-ahead the data and bring it to OS's PageCache. 
CloudDrives (and ssd) have bad-latency and good-parallel-throughput - then having >1k of warmup threads will help.`,
		Value: uint64(backup.ReadAheadThreads),
	}
)
View Source
var (
	SnapshotFromFlag = cli.Uint64Flag{
		Name:  "from",
		Usage: "From block number",
		Value: 0,
	}
	SnapshotToFlag = cli.Uint64Flag{
		Name:  "to",
		Usage: "To block number. Zero - means unlimited.",
		Value: 0,
	}
	SnapshotEveryFlag = cli.Uint64Flag{
		Name:  "every",
		Usage: "Do operation every N blocks",
		Value: 1_000,
	}
	SnapshotRebuildFlag = cli.BoolFlag{
		Name:  "rebuild",
		Usage: "Force rebuild",
	}
)

Functions

func ChainHasBlock

func ChainHasBlock(chainDB kv.RwDB, block *types.Block) bool

func ConnectDiagnostics

func ConnectDiagnostics(cliCtx *cli.Context, logger log.Logger) error

func ImportChain

func ImportChain(ethereum *eth.Ethereum, chainDB kv.RwDB, fn string, logger log.Logger) error

func InsertChain

func InsertChain(ethereum *eth.Ethereum, chain *core.ChainPack, logger log.Logger) error

func MakeApp

func MakeApp(name string, action cli.ActionFunc, cliFlags []cli.Flag) *cli.App

MakeApp creates a cli application (based on `github.com/urlfave/cli` package). The application exits when `action` returns. Parameters: * action: the main function for the application. receives `*cli.Context` with parsed command-line flags. * cliFlags: the list of flags `cli.Flag` that the app should set and parse. By default, use `DefaultFlags()`. If you want to specify your own flag, use `append(DefaultFlags(), myFlag)` for this parameter.

func MakeConfigNodeDefault

func MakeConfigNodeDefault(cliCtx *cli.Context, logger log.Logger) *node.Node

func MigrateFlags

func MigrateFlags(action cli.ActionFunc) cli.ActionFunc

MigrateFlags makes all global flag values available in the context. This should be called as early as possible in app.Before.

Example:

geth account new --keystore /tmp/mykeystore --lightkdf

is equivalent after calling this method with:

geth --keystore /tmp/mykeystore --lightkdf account new

i.e. in the subcommand Action function of 'account new', ctx.Bool("lightkdf) will return true even if --lightkdf is set as a global option.

This function may become unnecessary when https://github.com/urfave/cli/pull/1245 is merged.

func NewNodeConfig

func NewNodeConfig(ctx *cli.Context) *nodecfg.Config

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL