Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtomicWrite ¶
AtomicWrite writes data to path atomically using a temp file in the same directory followed by a rename. This ensures that a crash mid-write leaves the existing file intact. If the target file already exists, its permissions are preserved; otherwise 0644 is used.
func AtomicWriteWithPerm ¶
AtomicWriteWithPerm writes data to path atomically using a temp file in the same directory followed by a rename. The perm parameter is the fallback permission used when the target file does not yet exist. If the target file already exists, its current permissions are preserved (H-19).
Types ¶
type FileLock ¶ added in v1.3.0
type FileLock struct {
// contains filtered or unexported fields
}
FileLock provides advisory file locking using flock(2). Used to prevent concurrent M31A instances from corrupting shared session files in the same project directory.
func NewFileLock ¶ added in v1.3.0
NewFileLock creates a FileLock for the given path. The lock file is created on Lock() if it doesn't exist.
func (*FileLock) Lock ¶ added in v1.3.0
Lock acquires an exclusive lock on the file. Blocks until the lock is available. Returns an error if the file cannot be opened.