@cryptotaxi247 / kubo / commits / dc7374408

fsrepo: Detect uninitialized repo by missing config file

Earlier, it also checked checked the leveldb directory. That part added no crash safety to the application, and just hardcoded assumptions about the datastore. If anything, this should rely on the absolute last item created by fsrepo.Init, and there should be fsync guarantees about ordering. License: MIT Signed-off-by: Tommi Virtanen <tv@eagain.net>

Tommi Virtanen committed May 19, 2015 at 16:05 UTC dc7374408271715840b1d3bfda3deabf783a563c
1 file changed +2
repo/fsrepo/fsrepo.go
+2
@@ -622,8 +622,10 @@ func isInitializedUnsynced(repoPath string) bool {
622 if !configIsInitialized(repoPath) {
623 return false
624 }
625 +
626 if !util.FileExists(filepath.Join(repoPath, leveldbDirectory)) {
627 return false
628 }
629 +
630 return true
631 }