mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 22:30:56 +03:00
sftpfs: add buffering support
this way we improve performance over high latency networks
This commit is contained in:
31
vfs/vfs.go
31
vfs/vfs.go
@@ -553,11 +553,42 @@ func IsSFTPFs(fs Fs) bool {
|
||||
return strings.HasPrefix(fs.Name(), sftpFsName)
|
||||
}
|
||||
|
||||
// IsBufferedSFTPFs returns true if this is a buffered SFTP filesystem
|
||||
func IsBufferedSFTPFs(fs Fs) bool {
|
||||
if !IsSFTPFs(fs) {
|
||||
return false
|
||||
}
|
||||
return !fs.IsUploadResumeSupported()
|
||||
}
|
||||
|
||||
// IsLocalOrUnbufferedSFTPFs returns true if fs is local or SFTP with no buffer
|
||||
func IsLocalOrUnbufferedSFTPFs(fs Fs) bool {
|
||||
if IsLocalOsFs(fs) {
|
||||
return true
|
||||
}
|
||||
if IsSFTPFs(fs) {
|
||||
return fs.IsUploadResumeSupported()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsLocalOrSFTPFs returns true if fs is local or SFTP
|
||||
func IsLocalOrSFTPFs(fs Fs) bool {
|
||||
return IsLocalOsFs(fs) || IsSFTPFs(fs)
|
||||
}
|
||||
|
||||
// HasOpenRWSupport returns true if the fs can open a file
|
||||
// for reading and writing at the same time
|
||||
func HasOpenRWSupport(fs Fs) bool {
|
||||
if IsLocalOsFs(fs) {
|
||||
return true
|
||||
}
|
||||
if IsSFTPFs(fs) && fs.IsUploadResumeSupported() {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsLocalOrCryptoFs returns true if fs is local or local encrypted
|
||||
func IsLocalOrCryptoFs(fs Fs) bool {
|
||||
return IsLocalOsFs(fs) || IsCryptOsFs(fs)
|
||||
|
||||
Reference in New Issue
Block a user