NewFileLock returns a lock using path as its persistent sentinel file.
(path string)
| 52 | |
| 53 | // NewFileLock returns a lock using path as its persistent sentinel file. |
| 54 | func NewFileLock(path string) *FileLock { |
| 55 | absPath, err := filepath.Abs(path) |
| 56 | if err != nil { |
| 57 | absPath = path |
| 58 | } |
| 59 | processLockValue, _ := processLocks.LoadOrStore(absPath, newProcessLock()) |
| 60 | return &FileLock{ |
| 61 | path: absPath, |
| 62 | processLock: processLockValue.(processLock), |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // LockPathForDatabase returns the companion lock-file path for a memory DB. |
| 67 | func LockPathForDatabase(dbPath string) string { |