func Open(cfg *config.Config) (*DB, error) { s, err := driver.GetStore(cfg) if err != nil { return nil, err } path := getStorePath(cfg) if err := os.MkdirAll(path, 0755); err != nil { return nil, err } idb, err := s.Open(path, cfg) if err != nil { return nil, err } db := new(DB) db.db = idb db.name = s.String() db.st = &Stat{} db.cfg = cfg return db, nil }
func Repair(cfg *config.Config) error { s, err := driver.GetStore(cfg) if err != nil { return err } path := getStorePath(cfg) return s.Repair(path, cfg) }