2019-11-25 13:46:36 +00:00
package commands
2020-03-30 18:56:53 +00:00
import (
2020-04-20 10:35:33 +00:00
"github.com/ledgerwatch/turbo-geth/common/dbutils"
2020-03-30 18:56:53 +00:00
"github.com/spf13/cobra"
)
2019-11-25 13:46:36 +00:00
var (
2019-12-04 10:10:42 +00:00
chaindata string
statsfile string
block uint64
remoteDbAddress string
2020-04-20 10:35:33 +00:00
changeSetBucket string
indexBucket string
2019-11-25 13:46:36 +00:00
)
2020-04-14 12:51:20 +00:00
func must ( err error ) {
if err != nil {
panic ( err )
}
}
2019-11-25 13:46:36 +00:00
func withBlock ( cmd * cobra . Command ) {
cmd . Flags ( ) . Uint64Var ( & block , "block" , 1 , "specifies a block number for operation" )
}
func withChaindata ( cmd * cobra . Command ) {
cmd . Flags ( ) . StringVar ( & chaindata , "chaindata" , "chaindata" , "path to the chaindata file used as input to analysis" )
2020-04-14 12:51:20 +00:00
must ( cmd . MarkFlagFilename ( "chaindata" , "" ) )
2019-11-25 13:46:36 +00:00
}
func withStatsfile ( cmd * cobra . Command ) {
cmd . Flags ( ) . StringVar ( & statsfile , "statsfile" , "stateless.csv" , "path where to write the stats file" )
2020-04-14 12:51:20 +00:00
must ( cmd . MarkFlagFilename ( "statsfile" , "csv" ) )
2019-11-25 13:46:36 +00:00
}
2019-12-03 09:55:15 +00:00
func withRemoteDb ( cmd * cobra . Command ) {
2019-12-04 10:10:42 +00:00
cmd . Flags ( ) . StringVar ( & remoteDbAddress , "remote-db-addr" , "" , "remote db rpc address" )
2019-12-03 09:55:15 +00:00
}
2020-04-20 10:35:33 +00:00
func withCSBucket ( cmd * cobra . Command ) {
cmd . Flags ( ) . StringVar ( & changeSetBucket , "changeset-bucket" , string ( dbutils . AccountChangeSetBucket ) , string ( dbutils . AccountChangeSetBucket ) + " for account and " + string ( dbutils . StorageChangeSetBucket ) + " for storage" )
}
func withIndexBucket ( cmd * cobra . Command ) {
cmd . Flags ( ) . StringVar ( & indexBucket , "index-bucket" , string ( dbutils . AccountsHistoryBucket ) , string ( dbutils . AccountsHistoryBucket ) + " for account and " + string ( dbutils . StorageHistoryBucket ) + " for storage" )
}