WebDAV: try to preserve the lock fs as much as possible

This commit is contained in:
Nicola Murino
2021-03-27 19:10:27 +01:00
parent 5f49af1780
commit 9ad750da54
17 changed files with 456 additions and 209 deletions

View File

@@ -72,6 +72,27 @@ func (f *Filesystem) SetNilSecretsIfEmpty() {
}
}
// IsEqual returns true if the fs is equal to other
func (f *Filesystem) IsEqual(other *Filesystem) bool {
if f.Provider != other.Provider {
return false
}
switch f.Provider {
case S3FilesystemProvider:
return f.S3Config.isEqual(&other.S3Config)
case GCSFilesystemProvider:
return f.GCSConfig.isEqual(&other.GCSConfig)
case AzureBlobFilesystemProvider:
return f.AzBlobConfig.isEqual(&other.AzBlobConfig)
case CryptedFilesystemProvider:
return f.CryptConfig.isEqual(&other.CryptConfig)
case SFTPFilesystemProvider:
return f.SFTPConfig.isEqual(&other.SFTPConfig)
default:
return true
}
}
// GetACopy returns a copy
func (f *Filesystem) GetACopy() Filesystem {
f.SetEmptySecretsIfNil()