2021-04-21 12:44:49 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import(
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
)
|
|
|
|
|
|
|
|
func checkRootFolder(storage string) {
|
|
|
|
checked_folders := map[string]bool{"fs": false, "commits": false, "blocks": false}
|
2021-04-21 13:54:50 +00:00
|
|
|
for f, _ := range checked_folders {
|
|
|
|
if info, err := os.Stat(filepath.Join(storage, f)); err == nil && info.IsDir() {
|
|
|
|
checked_folders[f] = true
|
2021-04-21 12:44:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for path, seen := range checked_folders {
|
|
|
|
if !seen { log.Fatal("Folder ", path, " is required but not present!") }
|
|
|
|
}
|
|
|
|
}
|
2021-04-21 13:17:22 +00:00
|
|
|
|
|
|
|
func repoExistsIn(storage string, repoId string) map[string]bool {
|
|
|
|
exists_in := map[string]bool{"fs": false, "commits": false, "blocks": false}
|
|
|
|
|
|
|
|
for storageType, _ := range exists_in {
|
|
|
|
if info, err := os.Stat(filepath.Join(storage, storageType, repoId)); err == nil && info.IsDir() {
|
|
|
|
exists_in[storageType] = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return exists_in
|
|
|
|
}
|