()
| 58 | } |
| 59 | |
| 60 | func CloseDB() { |
| 61 | masterMu.Lock() |
| 62 | defer masterMu.Unlock() |
| 63 | baseDir = "" |
| 64 | configured = false |
| 65 | // Reset cleanupOnce under its own dedicated mutex so it is safe to call |
| 66 | // concurrently with ensureDirs, which also holds cleanupMu when it reads it. |
| 67 | cleanupMu.Lock() |
| 68 | cleanupOnce = sync.Once{} |
| 69 | cleanupMu.Unlock() |
| 70 | } |
| 71 | |
| 72 | func atomicWrite(targetPath string, data interface{}) error { |
| 73 | dir := filepath.Dir(targetPath) |
no outgoing calls