diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-07-23 16:17:18 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-07-23 16:17:18 +0800 |
commit | b403b9e4c398a285c0e307771761b29bab47adb9 (patch) | |
tree | b9991d8a9ab71e84a1350e0769ec9ae59ecd3cc0 /cmd/utils/flags.go | |
parent | 26a269ea09667f7e49b89f96bb5eaee66c0d10f8 (diff) | |
parent | c7e7778f2a7d80fa12643db546db98fa70f2e384 (diff) | |
download | go-tangerine-b403b9e4c398a285c0e307771761b29bab47adb9.tar go-tangerine-b403b9e4c398a285c0e307771761b29bab47adb9.tar.gz go-tangerine-b403b9e4c398a285c0e307771761b29bab47adb9.tar.bz2 go-tangerine-b403b9e4c398a285c0e307771761b29bab47adb9.tar.lz go-tangerine-b403b9e4c398a285c0e307771761b29bab47adb9.tar.xz go-tangerine-b403b9e4c398a285c0e307771761b29bab47adb9.tar.zst go-tangerine-b403b9e4c398a285c0e307771761b29bab47adb9.zip |
Merge pull request #1508 from karalabe/database-caching
cmd, core, eth, ethdb: cache flag to allocate memory for db internal use
Diffstat (limited to 'cmd/utils/flags.go')
-rw-r--r-- | cmd/utils/flags.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 73bdb935a..68de67cde 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -126,6 +126,11 @@ var ( Name: "natspec", Usage: "Enable NatSpec confirmation notice", } + CacheFlag = cli.IntFlag{ + Name: "cache", + Usage: "Megabytes of memory allocated to internal caching", + Value: 0, + } // miner settings MinerThreadsFlag = cli.IntFlag{ @@ -384,6 +389,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config { GenesisNonce: ctx.GlobalInt(GenesisNonceFlag.Name), GenesisFile: ctx.GlobalString(GenesisFileFlag.Name), BlockChainVersion: ctx.GlobalInt(BlockchainVersionFlag.Name), + DatabaseCache: ctx.GlobalInt(CacheFlag.Name), SkipBcVersionCheck: false, NetworkId: ctx.GlobalInt(NetworkIdFlag.Name), LogFile: ctx.GlobalString(LogFileFlag.Name), @@ -425,15 +431,17 @@ func SetupLogger(ctx *cli.Context) { // MakeChain creates a chain manager from set command line flags. func MakeChain(ctx *cli.Context) (chain *core.ChainManager, blockDB, stateDB, extraDB common.Database) { - dd := ctx.GlobalString(DataDirFlag.Name) + datadir := ctx.GlobalString(DataDirFlag.Name) + cache := ctx.GlobalInt(CacheFlag.Name) + var err error - if blockDB, err = ethdb.NewLDBDatabase(filepath.Join(dd, "blockchain")); err != nil { + if blockDB, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "blockchain"), cache); err != nil { Fatalf("Could not open database: %v", err) } - if stateDB, err = ethdb.NewLDBDatabase(filepath.Join(dd, "state")); err != nil { + if stateDB, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "state"), cache); err != nil { Fatalf("Could not open database: %v", err) } - if extraDB, err = ethdb.NewLDBDatabase(filepath.Join(dd, "extra")); err != nil { + if extraDB, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "extra"), cache); err != nil { Fatalf("Could not open database: %v", err) } |