mirror of
https://github.com/tickstep/aliyunpan.git
synced 2025-01-23 14:32:14 +08:00
26 lines
317 B
Go
26 lines
317 B
Go
package filelocker
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
const (
|
|
lockExt = ".lock"
|
|
)
|
|
|
|
type (
|
|
FileLocker struct {
|
|
FilePath string
|
|
LockFilePath string
|
|
lockFile *os.File
|
|
}
|
|
)
|
|
|
|
func NewFileLocker(path string) *FileLocker {
|
|
return &FileLocker{
|
|
FilePath: path,
|
|
LockFilePath: path + lockExt,
|
|
lockFile: nil,
|
|
}
|
|
}
|