Example #1
0
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
}
Example #2
0
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
}
Example #3
0
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
}
Example #4
0
func (s BoltDBStore) Repair(cfg *Config) error {
	c := &boltdb.Config{}
	copier.Copy(c, cfg)

	return boltdb.Repair(c)
}
Example #5
0
func (s BoltDBStore) Open(cfg *Config) (driver.IDB, error) {
	c := &boltdb.Config{}
	copier.Copy(c, cfg)

	return boltdb.Open(c)
}
Example #6
0
func (s RocksDBStore) Repair(cfg *Config) error {
	c := &rocksdb.Config{}
	copier.Copy(c, cfg)

	return rocksdb.Repair(c)
}
Example #7
0
func (s RocksDBStore) Open(cfg *Config) (driver.IDB, error) {
	c := &rocksdb.Config{}
	copier.Copy(c, cfg)

	return rocksdb.Open(c)
}
Example #8
0
func (s LMDBStore) Repair(cfg *Config) error {
	c := &mdb.Config{}
	copier.Copy(c, cfg)

	return mdb.Repair(c)
}
Example #9
0
func (s LMDBStore) Open(cfg *Config) (driver.IDB, error) {
	c := &mdb.Config{}
	copier.Copy(c, cfg)

	return mdb.Open(c)
}
Example #10
0
func (s GoLevelDBStore) Repair(cfg *Config) error {
	c := &goleveldb.Config{}
	copier.Copy(c, cfg)

	return goleveldb.Repair(c)
}
Example #11
0
func (s GoLevelDBStore) Open(cfg *Config) (driver.IDB, error) {
	c := &goleveldb.Config{}
	copier.Copy(c, cfg)

	return goleveldb.Open(c)
}