cache read performance improvements
This commit is contained in:
parent
39c4720e40
commit
f69d3149f3
14 changed files with 140 additions and 71 deletions
34
pkg/provider/sftp/file.go
Normal file
34
pkg/provider/sftp/file.go
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (C) 2022 Marius Schellenberger
|
||||
|
||||
package sftp
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
|
||||
"github.com/pkg/sftp"
|
||||
)
|
||||
|
||||
type file struct {
|
||||
*sftp.File
|
||||
fs *FS
|
||||
}
|
||||
|
||||
func (f *file) ReadDir(_ int) (d []fs.DirEntry, err error) {
|
||||
list, err := f.Readdir(0)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
d = make([]fs.DirEntry, len(list))
|
||||
for i, v := range list {
|
||||
d[i] = fs.FileInfoToDirEntry(v)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (f *file) Readdir(_ int) ([]fs.FileInfo, error) {
|
||||
return f.fs.client.ReadDir(f.Name())
|
||||
}
|
||||
|
||||
func (file) Fd() uintptr {
|
||||
return 0
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue