Update localfs.go

This commit is contained in:
Seb3thehacker 2022-03-24 08:34:11 +00:00 committed by GitHub
parent b0b2a3c2c1
commit 223db1c714
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@ package localfs
import (
"encoding/json"
"errors"
"io"
"io/ioutil"
"net/http"
@ -151,6 +152,18 @@ func (b LocalfsBackend) Unlock(filename string) (err error) {
return
}
func (b LocalfsBackend) CheckLock(filename string) (locked bool, err error) {
lockPath := path.Join(b.locksPath, filename)
if _, err := os.Stat(lockPath); errors.Is(err, os.ErrNotExist) {
return false, nil
} else {
return true, nil
}
return false, err
}
func (b LocalfsBackend) Put(key string, r io.Reader, expiry time.Time, deleteKey, accessKey string, srcIp string) (m backends.Metadata, err error) {
filePath := path.Join(b.filesPath, key)