Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AtomicFileWriter ¶
type AtomicFileWriter interface {
io.Writer
Name() string
Current() io.Reader
AbortIfPending()
Commit() error
}
func OpenToChange ¶
func OpenToChange(filename string) (AtomicFileWriter, error)
type FileLock ¶
type FileLock interface {
// Name returns an absolute path to the locked file
Name() string
// Unlock releases the file lock
Unlock()
}
func TryLockFile ¶
TryLockFile and the returned FileLock implements Cooperative File Locking using a ".lock"-suffixed file that is atomically created to acquire the lock.
Cooperative file locking, such as implemented here, is not enforced at any level. Instead, it relies on participating threads/processes following the same procedure before changing protected files.
Click to show internal directories.
Click to hide internal directories.