sftp: implement DirSetModTime

This commit is contained in:
nielash 2024-01-13 08:19:37 -05:00 committed by Nick Craig-Wood
parent cbcb295185
commit 17c0ecc72c
2 changed files with 20 additions and 10 deletions

View File

@ -1367,6 +1367,15 @@ func (f *Fs) Mkdir(ctx context.Context, dir string) error {
return f.mkdir(ctx, root)
}
// DirSetModTime sets the directory modtime for dir
func (f *Fs) DirSetModTime(ctx context.Context, dir string, modTime time.Time) error {
o := Object{
fs: f,
remote: dir,
}
return o.SetModTime(ctx, modTime)
}
// Rmdir removes the root directory of the Fs object
func (f *Fs) Rmdir(ctx context.Context, dir string) error {
// Check to see if directory is empty as some servers will
@ -1985,7 +1994,7 @@ func (o *Object) SetModTime(ctx context.Context, modTime time.Time) error {
return fmt.Errorf("SetModTime failed: %w", err)
}
err = o.stat(ctx)
if err != nil {
if err != nil && err != fs.ErrorIsDir {
return fmt.Errorf("SetModTime stat failed: %w", err)
}
return nil
@ -2179,12 +2188,13 @@ func (o *Object) Remove(ctx context.Context) error {
// Check the interfaces are satisfied
var (
_ fs.Fs = &Fs{}
_ fs.PutStreamer = &Fs{}
_ fs.Mover = &Fs{}
_ fs.Copier = &Fs{}
_ fs.DirMover = &Fs{}
_ fs.Abouter = &Fs{}
_ fs.Shutdowner = &Fs{}
_ fs.Object = &Object{}
_ fs.Fs = &Fs{}
_ fs.PutStreamer = &Fs{}
_ fs.Mover = &Fs{}
_ fs.Copier = &Fs{}
_ fs.DirMover = &Fs{}
_ fs.DirSetModTimer = &Fs{}
_ fs.Abouter = &Fs{}
_ fs.Shutdowner = &Fs{}
_ fs.Object = &Object{}
)

View File

@ -52,7 +52,7 @@ Here is an overview of the major features of each cloud storage system.
| QingStor | MD5 | - ⁹ | No | No | R/W | - |
| Quatrix by Maytech | - | R/W | No | No | - | - |
| Seafile | - | - | No | No | - | - |
| SFTP | MD5, SHA1 ² | R/W | Depends | No | - | - |
| SFTP | MD5, SHA1 ² | DR/W | Depends | No | - | - |
| Sia | - | - | No | No | - | - |
| SMB | - | R/W | Yes | No | - | - |
| SugarSync | - | - | No | No | - | - |