func (cfg *Config) NewLedisConfig() *ledis.Config { c := new(ledis.Config) c.DataDir = cfg.DataDir copier.Copy(&c.DB, &cfg.DB) copier.Copy(&c.BinLog, &cfg.BinLog) return c }
func (cfg *Config) NewBinLogConfig() *BinLogConfig { binLogPath := path.Join(cfg.DataDir, "bin_log") c := new(BinLogConfig) copier.Copy(c, &cfg.BinLog) c.Path = binLogPath return c }
func (cfg *Config) NewDBConfig() *store.Config { if len(cfg.DB.Name) == 0 { fmt.Printf("no store set, use default %s\n", store.DefaultStoreName) cfg.DB.Name = store.DefaultStoreName } cfg.DB.Name = strings.ToLower(cfg.DB.Name) dbCfg := new(store.Config) copier.Copy(dbCfg, &cfg.DB) dbPath := path.Join(cfg.DataDir, fmt.Sprintf("%s_data", cfg.DB.Name)) dbCfg.Path = dbPath return dbCfg }
func (s BoltDBStore) Repair(cfg *Config) error { c := &boltdb.Config{} copier.Copy(c, cfg) return boltdb.Repair(c) }
func (s BoltDBStore) Open(cfg *Config) (driver.IDB, error) { c := &boltdb.Config{} copier.Copy(c, cfg) return boltdb.Open(c) }
func (s RocksDBStore) Repair(cfg *Config) error { c := &rocksdb.Config{} copier.Copy(c, cfg) return rocksdb.Repair(c) }
func (s RocksDBStore) Open(cfg *Config) (driver.IDB, error) { c := &rocksdb.Config{} copier.Copy(c, cfg) return rocksdb.Open(c) }
func (s LMDBStore) Repair(cfg *Config) error { c := &mdb.Config{} copier.Copy(c, cfg) return mdb.Repair(c) }
func (s LMDBStore) Open(cfg *Config) (driver.IDB, error) { c := &mdb.Config{} copier.Copy(c, cfg) return mdb.Open(c) }
func (s GoLevelDBStore) Repair(cfg *Config) error { c := &goleveldb.Config{} copier.Copy(c, cfg) return goleveldb.Repair(c) }
func (s GoLevelDBStore) Open(cfg *Config) (driver.IDB, error) { c := &goleveldb.Config{} copier.Copy(c, cfg) return goleveldb.Open(c) }