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
2020-10-13 12:56:16 +00:00
snapshotFile string
2019-12-04 10:10:42 +00:00
block uint64
2020-07-27 12:15:48 +00:00
privateApiAddr string
2020-04-20 10:35:33 +00:00
changeSetBucket string
indexBucket string
2020-10-17 07:48:20 +00:00
snapshotMode string
snapshotDir 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" )
}
2020-10-17 07:48:20 +00:00
func withSnapshotData ( cmd * cobra . Command ) {
cmd . Flags ( ) . StringVar ( & snapshotMode , "snapshotMode" , "" , "set of snapshots to use" )
cmd . Flags ( ) . StringVar ( & snapshotDir , "snapshotDir" , "" , "snapshot dir" )
}
2019-11-25 13:46:36 +00:00
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
2020-07-27 12:15:48 +00:00
func withPrivateApi ( cmd * cobra . Command ) {
cmd . Flags ( ) . StringVar ( & privateApiAddr , "private.api.addr" , "" , "private api network address, for example: 127.0.0.1:9090, empty string means not to start the listener. do not expose to public network. serves remote database interface" )
2019-12-03 09:55:15 +00:00
}
2020-04-20 10:35:33 +00:00
func withCSBucket ( cmd * cobra . Command ) {
2020-11-16 12:08:28 +00:00
cmd . Flags ( ) . StringVar ( & changeSetBucket , "changeset-bucket" , dbutils . AccountChangeSetBucket , dbutils . AccountChangeSetBucket + " for account and " + dbutils . StorageChangeSetBucket + " for storage" )
2020-04-20 10:35:33 +00:00
}
func withIndexBucket ( cmd * cobra . Command ) {
2020-11-16 12:08:28 +00:00
cmd . Flags ( ) . StringVar ( & indexBucket , "index-bucket" , dbutils . AccountsHistoryBucket , dbutils . AccountsHistoryBucket + " for account and " + dbutils . StorageHistoryBucket + " for storage" )
2020-04-20 10:35:33 +00:00
}