From b1af8fd87760b34e3ff2fd3bda38f211815a0473 Mon Sep 17 00:00:00 2001 From: Terin Stock Date: Sun, 9 Mar 2025 17:47:56 +0100 Subject: [chore] remove vendor --- .../github.com/ncruces/go-sqlite3/vfs/os_dotlk.go | 140 --------------------- 1 file changed, 140 deletions(-) delete mode 100644 vendor/github.com/ncruces/go-sqlite3/vfs/os_dotlk.go (limited to 'vendor/github.com/ncruces/go-sqlite3/vfs/os_dotlk.go') diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_dotlk.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_dotlk.go deleted file mode 100644 index b64e8ec05..000000000 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_dotlk.go +++ /dev/null @@ -1,140 +0,0 @@ -//go:build sqlite3_dotlk - -package vfs - -import ( - "errors" - "io/fs" - "os" - "sync" - - "github.com/ncruces/go-sqlite3/internal/dotlk" -) - -var ( - // +checklocks:vfsDotLocksMtx - vfsDotLocks = map[string]*vfsDotLocker{} - vfsDotLocksMtx sync.Mutex -) - -type vfsDotLocker struct { - shared int // +checklocks:vfsDotLocksMtx - pending *os.File // +checklocks:vfsDotLocksMtx - reserved *os.File // +checklocks:vfsDotLocksMtx -} - -func osGetSharedLock(file *os.File) error { - vfsDotLocksMtx.Lock() - defer vfsDotLocksMtx.Unlock() - - name := file.Name() - locker := vfsDotLocks[name] - if locker == nil { - if err := dotlk.TryLock(name + ".lock"); err != nil { - if errors.Is(err, fs.ErrExist) { - return _BUSY // Another process has the lock. - } - return sysError{err, _IOERR_LOCK} - } - locker = &vfsDotLocker{} - vfsDotLocks[name] = locker - } - - if locker.pending != nil { - return _BUSY - } - locker.shared++ - return nil -} - -func osGetReservedLock(file *os.File) error { - vfsDotLocksMtx.Lock() - defer vfsDotLocksMtx.Unlock() - - name := file.Name() - locker := vfsDotLocks[name] - if locker == nil { - return _IOERR_LOCK - } - - if locker.reserved != nil && locker.reserved != file { - return _BUSY - } - locker.reserved = file - return nil -} - -func osGetExclusiveLock(file *os.File, _ *LockLevel) error { - vfsDotLocksMtx.Lock() - defer vfsDotLocksMtx.Unlock() - - name := file.Name() - locker := vfsDotLocks[name] - if locker == nil { - return _IOERR_LOCK - } - - if locker.pending != nil && locker.pending != file { - return _BUSY - } - locker.pending = file - if locker.shared > 1 { - return _BUSY - } - return nil -} - -func osDowngradeLock(file *os.File, _ LockLevel) error { - vfsDotLocksMtx.Lock() - defer vfsDotLocksMtx.Unlock() - - name := file.Name() - locker := vfsDotLocks[name] - if locker == nil { - return _IOERR_UNLOCK - } - - if locker.reserved == file { - locker.reserved = nil - } - if locker.pending == file { - locker.pending = nil - } - return nil -} - -func osReleaseLock(file *os.File, state LockLevel) error { - vfsDotLocksMtx.Lock() - defer vfsDotLocksMtx.Unlock() - - name := file.Name() - locker := vfsDotLocks[name] - if locker == nil { - return _IOERR_UNLOCK - } - - if locker.shared == 1 { - if err := dotlk.Unlock(name + ".lock"); err != nil { - return sysError{err, _IOERR_UNLOCK} - } - delete(vfsDotLocks, name) - } - - if locker.reserved == file { - locker.reserved = nil - } - if locker.pending == file { - locker.pending = nil - } - locker.shared-- - return nil -} - -func osCheckReservedLock(file *os.File) (bool, error) { - vfsDotLocksMtx.Lock() - defer vfsDotLocksMtx.Unlock() - - name := file.Name() - locker := vfsDotLocks[name] - return locker != nil && locker.reserved != nil, nil -} -- cgit v1.2.3