From 1c9a7095b3d293e0b94cb8ed89f1a1654d2d2277 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 13 Sep 2013 18:02:10 -0500 Subject: [PATCH] Change --dbdir flag to --datadir. This change paves the way for saving more than just the block database to the filesystem (such as address manager data, index data, etc) where the name "dbdir" no longer makes sense. --- blockmanager.go | 4 ++-- config.go | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/blockmanager.go b/blockmanager.go index 5a395b8f..aa9507e6 100644 --- a/blockmanager.go +++ b/blockmanager.go @@ -394,7 +394,7 @@ func newBlockManager(s *server) *blockManager { // loadBlockDB opens the block database and returns a handle to it. func loadBlockDB() (btcdb.Db, error) { - dbPath := filepath.Join(cfg.DbDir, activeNetParams.dbName) + dbPath := filepath.Join(cfg.DataDir, activeNetParams.dbName) log.Infof("[BMGR] Loading block database from '%s'", dbPath) db, err := btcdb.OpenDB(cfg.DbType, dbPath) if err != nil { @@ -405,7 +405,7 @@ func loadBlockDB() (btcdb.Db, error) { } // Create the db if it does not exist. - err = os.MkdirAll(cfg.DbDir, 0700) + err = os.MkdirAll(cfg.DataDir, 0700) if err != nil { return nil, err } diff --git a/config.go b/config.go index 815fbe88..0de626c2 100644 --- a/config.go +++ b/config.go @@ -29,7 +29,7 @@ const ( var ( defaultConfigFile = filepath.Join(btcdHomeDir(), defaultConfigFilename) - defaultDbDir = filepath.Join(btcdHomeDir(), "db") + defaultDataDir = filepath.Join(btcdHomeDir(), "db") ) // config defines the configuration options for btcd. @@ -38,7 +38,7 @@ var ( type config struct { ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"` ConfigFile string `short:"C" long:"configfile" description:"Path to configuration file"` - DbDir string `short:"b" long:"dbdir" description:"Directory to store database"` + DataDir string `short:"b" long:"datadir" description:"Directory to store data"` AddPeers []string `short:"a" long:"addpeer" description:"Add a peer to connect with at startup"` ConnectPeers []string `long:"connect" description:"Connect only to the specified peers at startup"` SeedPeer string `short:"s" long:"seedpeer" description:"Retrieve peer addresses from this peer and then disconnect"` @@ -58,7 +58,7 @@ type config struct { UseTor bool `long:"tor" description:"Specifies the proxy server used is a Tor node"` TestNet3 bool `long:"testnet" description:"Use the test network"` RegressionTest bool `long:"regtest" description:"Use the regression test network"` - DbType string `long:"dbtype" description:"DB backend to use for Block Chain"` + DbType string `long:"dbtype" description:"DB backend to use for Block Chain"` DebugLevel string `short:"d" long:"debuglevel" description:"Logging level {trace, debug, info, warn, error, critical}"` } @@ -179,7 +179,7 @@ func loadConfig() (*config, []string, error) { MaxPeers: defaultMaxPeers, BanDuration: defaultBanDuration, ConfigFile: defaultConfigFile, - DbDir: defaultDbDir, + DataDir: defaultDataDir, } // Pre-parse the command line options to see if an alternative config @@ -317,7 +317,7 @@ func loadConfig() (*config, []string, error) { // type the database is (if the specified database is a // file then it is sqlite3, if it is a directory assume // it is leveldb, if not found default to type _____ - dbPath := filepath.Join(cfg.DbDir, activeNetParams.dbName) + dbPath := filepath.Join(cfg.DataDir, activeNetParams.dbName) fi, err := os.Stat(dbPath) if err == nil {